比如说Employee 是一个类,有一个对像是staff[3],有一个方法:getname();
那这个是什么意思,
for(Employee e:staff)
e.getname;这个是什么意思?他的作用是显示staff数组里的所有东西.
"e"是什么?
那这个是什么意思,
for(Employee e:staff)
e.getname;这个是什么意思?他的作用是显示staff数组里的所有东西.
"e"是什么?
for(int i=0;i<staff.length;i++){
Employee e = (Employee)staff[i];
e.getname;
}
这种写法是JDK5.0新的缩写方式
与普通的for(int i = 0;i < len; i ++)一样