public class BinaryArray {

public static void main(String[] args) {
//二维数组定义和初始化
int[][] arrs = { { 1, 2, 3 }, { 4, 5, 6 }, { 6, 8, 9 } };
//二维数组遍历输出
for (int i = 0; i < arrs.length; i++) {
for (int j = 0; j < arrs[i].length; j++) {
System.out.print(arrs[i][j]);
}

System.out.println("");
}

//增强for循环 是jdk 5.0 以后才有的新的特性
String[] names = { "黎明", "张胜", "李阳" };
for (String name : names) {
System.out.print(name + ",");
}

//定义一个课程的二维表结构
String[][] courses = { { "C001", "英语" }, { "C002", "数学" }, { "C003", "Java编程" } };
System.out.println("\n---------------------");
//输出
for (String[] rows : courses) {
for (String col : rows) {
System.out.print(col + ",");
}
System.out.println("");
}
}
}