利用增强for循环进行遍历
public class Demo05 {
//二维数组
public static void main(String[] args) {
int[][] arrays = {{1,1,1,1},{45,8,9,7},{},{4,5,4,5},{4,9,8}};
printArrays(arrays);
}
public static void printArrays(int[][] arrays){
for (int[] array : arrays) {
for (int i : array) {
System.out.print(i + " ");
}
System.out.println();
}
}
}