Last Modified 2019.2.1

static import

A static import statement was introduced in Java 5. With static import statements, you can omit the class name when using static members.

package net.java_school.examples;

import static java.lang.Math.*;

public class StaticImportTest {
	public static void main(String[] args) {
		System.out.println(sqrt(4));//You can omit Math.

import java.util. *;
In the above import statement, * means all types in the java.util package.
import static java.lang.Math. *;
In the above import statement, * means all static members of the Math class.
If you only want the sqrt() method of the Math class, modify the import statement as follows:
import static java.lang.Math.sqrt;