public class Demo05 {标签:int,System,二维,数组,println,length,array,out From: https://www.cnblogs.com/123jgh/p/16784877.html
public static void main(String[] args) {
/*[5][2] 面对对象
1,2 array[0]
2,3 array[1]
3,4 array[2]
4,5 array[3]
5,6 array[4]
*/
int[][] array = {{1,2},{2,3},{3,4},{4,5},{5,6}};
for (int i =0;i < array.length;i++){
for (int j = 0;j < array[i].length;j++){
System.out.print(array[i][j]);
}
}
System.out.println("===============================");
//System.out.println(array[0]);
printArray(array[0]);
System.out.print(array[2][0]+" ");
System.out.println(array[2][1]);
System.out.println(array.length);
System.out.println(array[3].length);
}
//打印数组元素
public static void printArray(int[] arrays){
for (int i = 0;i < arrays.length;i++){
System.out.print(arrays[i]+", ");
}
}
}