public static void main(String[] args) { char[][] chs = new char[3][]; chs[0] = new char[]{'1','2','3'}; chs[1] = new char[]{'4','5','6'}; chs[2] = new char[]{'7','8','9'}; //遍历二维数组 for (int i = 0; i < chs.length; i++) { char [] items = chs[i]; for (int j = 0; j < items.length; j++) { System.out.print(items[j] + "\t"); } System.out.println();// 1 2 3// 4 5 6// 7 8 9 } System.out.println("---------"); for (int i = 0; i < chs.length; i++) { char [] items = chs[i]; for (int j = 0; j < items.length; j++) { System.out.print(chs[i][j] + "\t"); } System.out.println(); }// 1 2 3// 4 5 6// 7 8 9 }