例子1
import static java.lang.System.*;
省略程序中所有的“System”字段,如:
out.println("Hello World"); //正确
exit(0); //正确
例子2
import static java.lang.System.out;
只省略程序中使用System.out时的“System”字段,如:
out.println("Hello World"); //正确
exit(0); //错误,无法通过编译
优点
使程序更清爽
缺点
容易混淆(机器和人都一样)