public class Text {
public static void main(String[] args) {
char[] chArr={'A','B','C'};
for(int i=0;i<chArr.length;i++)
System.out.print(chArr[i]+" ");
//传统的遍历输出方式
System.out.println();
for(char i:chArr){
System.out.print(i+" ");
}
//整体每一个都遍历,用此比较简便
int[][] arr={{1,2,3},{4,5,6},{7,8,9}};
for(int i[]:arr){
for(int j:i)
System.out.print(j);
System.out.println();
}
//二维数组的遍历输出
String str="OK";
String str1="OK";
System.out.println(str==str1);//结果为true
String str2=new String("OK");
String str3=new String("OK");
System.out.println(str2==str3);//结果为false
System.out.println(str2.equals(str3));//结果为true,比较对象的值
int[][] arry2d1={{1,3,5},{2,4,6}};
int[][] arry2d2={{111,3,5},{2,444,6}};
int[][][] arry={arry2d1,arry2d2};
for(int[][] a:arry){
for(int[] b:a){
for(int c:b){
System.out.print(c+" ");
}
System.out.println();
}
System.out.println();
}//三维数组的遍历输出
}
}