遍历字符串数组
public class Test9 {
public static void main(String[] args) {
String[] strings = new String[5];
strings[0] = "刘";
strings[1] = "关";
strings[2] = "张";
// 遍历
for(int i=0;i<strings.length;i++){
String item = strings[i];
System.out.println(item);
}
}
}
遍历整数数组
// 有默认值的数组定义完成
int[] ints = {33, 44, 55};
// 遍历这个数组
for (int i = 0; i < ints.length; i++) {
System.out.println(ints[i]);
}