Static importing the Math Class Methods : Static Import « Class Definition « Java Tutorial






import static java.lang.Math.sqrt;

public class MainClass {

  public static void main(String[] arg) {
    System.out.println(sqrt(2));
  }

}
1.4142135623730951








5.31.Static Import
5.31.1.Static import
5.31.2.Static importing the Math Class Methods
5.31.3.Use static import to bring sqrt() and pow() into view.