for (int x : number)
增强型的for循环
主要用来处理数组或集合的循环
package com.scanner;
public class Demo08 {
public static void main(String[] args){
int[] number = {10, 20, 30, 40, 50}; //定义了一个数组
for (int x:number){
System.out.println(x);
}
}
}

浙公网安备 33010602011771号