增强for
package base;
public class Demo8 {
public static void main(String[] args) {
int[] numbers={1,2,3,4,5};
for(int i=0;i<5;i++){
System.out.println(numbers[i]);
}
for (int x:numbers){
System.out.println(x);
}
}
}
2024-03-17 11:53:04
package base;
public class Demo8 {
public static void main(String[] args) {
int[] numbers={1,2,3,4,5};
for(int i=0;i<5;i++){
System.out.println(numbers[i]);
}
for (int x:numbers){
System.out.println(x);
}
}
}