Static Import
靜态導入比較容易了解,可以直接看例子
import static java.lang.Math.*;
public class ImportStatic{
public static void main(String[] args) {
System.out.println(max(3, 6));
System.out.println(abs(3-6));
}
}
import xxxx 和 import static xxxx的差別是前者一般導入的是類檔案如import java.util.Scanner;後者一般是導入靜态的方法,import static java.lang.System.out;