public class Demo05 {标签:arrays,System,int,数组,多维,println,out From: https://www.cnblogs.com/123456dh/p/17095107.html
//多维数组
public static void main(String[] args) {
int[][] arrays={{1,2},{3,4},{5,6},{7,8},{9,10}};//定义数组方法一
// int[][] array=new int[2][5]; //定义数组方法二
// print(arrays[0]);
// System.out.println(arrays[0][1]);
// System.out.println(arrays.length);
// System.out.println(arrays[0].length);
//遍历二维数组
for (int i = 0; i <arrays.length ; i++) {
for (int j = 0; j <arrays[i].length ; j++) {
System.out.println(arrays[i][j]);
}
}
}
//打印数组元素
public static void print(int[] arrays){
for (int i = 0; i <arrays.length ; i++) {
System.out.println(arrays[i]);
}
}
}