JAVA输出二维数组执行不了,求大佬指点
double[][]a0=newdouble[3][];double[][]b=newdouble[3][];b[0]=newdouble[3];b[1]=newdoub...
double [][]a0=new double[3][];
double [][]b = new double[3][];
b[0]=new double[3];
b[1]=new double[2];
b[2]=new double[4];
b[0][0]=90.5;b[0][1]=93.5;b[0][2]=95.6;
b[1][0]=89.6;b[1][1]=99.2;
b[2][0]=78.4;b[2][1]=87.7;b[2][2]=98.2;b[2][3]=100.0;
for(int i=0;i<a0.length;i++) {
System.out.print("{");
for(int j=0;j<a0[i].length;j++) {
System.out.print("arr[i][j]");
}
System.out.print("}");
System.out.print("\n");
报错是a0[i] is null,读不了length 展开
double [][]b = new double[3][];
b[0]=new double[3];
b[1]=new double[2];
b[2]=new double[4];
b[0][0]=90.5;b[0][1]=93.5;b[0][2]=95.6;
b[1][0]=89.6;b[1][1]=99.2;
b[2][0]=78.4;b[2][1]=87.7;b[2][2]=98.2;b[2][3]=100.0;
for(int i=0;i<a0.length;i++) {
System.out.print("{");
for(int j=0;j<a0[i].length;j++) {
System.out.print("arr[i][j]");
}
System.out.print("}");
System.out.print("\n");
报错是a0[i] is null,读不了length 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询