多維數組的語法格式:java
說明:C中的數組是矩陣形式,但Java不是。數組
數組的初始化操做code
多維數組的程序示例內存
public class ArrayInArray { public static void main(String[] args) { int[][] arr=new int[][]{ {1,2,3}, {4,5}, {6}, }; printArray(arr); } static void printArray(int[][] arr){ for(int i=0;i<arr.length;i++){ System.out.println(arr[i]); for(int j=0; j<arr[i].length; j++){ System.out.println(arr[i][j]); } } } }
多維數組的程序示例運行結果class
[I@1db9742 1 2 3 [I@106d69c 4 5 [I@52e922 6
數組的內存分析語法