1.增强for循环
ArrayList<String> al = new ArrayList<String>();
for(ArrayList<String> a : al)即可对集合内对象进行遍历。
缺点是不能对集合本身进行操作。
2.可变参数
int sum(int... a)
方便传入参数
3.静态导入
import static java.lang.System.* //导入System类中所有静态成员。
即可在后面的程序中 直接调用System类中的静态方法,例如out.println("aaa")
注意:
1.当类名重名时,需要指定具体的包名。
2.当方法名重名时,需要指定所属的对象或者类。