- //数组反射类Array,能对数组反射获取,赋值和实例化
- int[][] arr = {{1,2},{3,4}};
-
- System.out.println(Array.get(Array.get(arr, 1), 1));//arr[1][1]
-
- int[][] arr2 = (int[][]) Array.newInstance(int[].class, 2);//int[][] arr2 = new int[][];
-
- System.out.println(arr2.getClass());//class [[I 创建成功
复制代码 |