如果想在 foreach 语句中获取数组元素的下标,该如何做呢??
int count=0;
for ( int score : scores ) {
System.out.print(score);
System.out.println(" 当前数组元素的下标为" + count);
count++;
}
int count=0;
for ( int score : scores ) {
System.out.print(score);
System.out.println(" 当前数组元素的下标为" + count);
count++;
}
2015-05-24
举报