二维数组
1 package array; 2 3 public class ArrayDemo05 { 4 public static void main(String[] args) { 5 //[4][2] 6 /* 7 1,2 array[0] 8 2,3 array[1] 9 3,4 array[2] 10 4,5 array[3] 11 5,6 array[4] 12 6,7 array[5] 13 */ 14 int[][] array = {{1,2},{2,3},{3,4},{4,5},{5,6},{6,7}}; 15 for (int i = 0; i < array.length; i++) { 16 for (int j = 0; j < array[i].length; j++) { 17 System.out.print(array[i][j]); 18 } 19 } 20 21 System.out.println(array[0][0]); 22 System.out.println(array[0][1]); 23 System.out.println(array[1][0]); 24 System.out.println(array[1][1]); 25 System.out.println(array[2][0]); 26 System.out.println(array[3][1]); 27 28 System.out.println(array.length);//6 29 System.out.println(array[0].length);//2 30 31 } 32 }