JDK1.5对for循环语句的功能进行了扩充,提供了更方便的遍历数组方式,语法声明如下:
for(生命循环变量:数组的名字){
…
}
public class demo {
public static void main (String[] args)throws Exception {
int a[]={1,2,3,4};
char b[]={'J','a','v','a'};
for(int i=0;i
JDK1.5对for循环语句的功能进行了扩充,提供了更方便的遍历数组方式,语法声明如下:
for(生命循环变量:数组的名字){
…
}
public class demo {
public static void main (String[] args)throws Exception {
int a[]={1,2,3,4};
char b[]={'J','a','v','a'};
for(int i=0;i