public static void main(String[] args) {
int[][] arr6 = { { 6, 9 }, { 9, 10 }, { 9, 10 } };
int arr7[][] = { { 7, 9 }, { 9, 10 }, { 9, 10 } };
int[] arr8[] = { { 8, 9 }, { 9, 10 }, { 9, 10 } };
System.out.println(arr6[0][0]);
System.out.println(arr7[0][0]);
System.out.println(arr8[0][0]);
int arr9[] = { 9, 2, 3 };
int[] arr10 = { 10, 2 };
System.out.println(arr9[0]);
System.out.println(arr10[1]);
}
数组赋值不能那样赋
java的数组只能在声明时这么赋值:int[][] arr6={{6,9},{9,10},{9,10}};
你写的arr6,7,8,9不能这么赋值,会报错“Array constants can only be used in initializers”
已经初始化了的数组只能针对每个节点赋值:
arr6[0][0]=6;
arr6[0][1]=9;
........
System.out.println(arr9[0];
,少个括号
百度下java 赋值规则。。。。。。。。