java创建2维数组程序问题

java创建2维数组程序问题
public class TwoDimArray{
static Random rand = new Random();
static int pRand(int mod){
return Math.abs(rand.nextInt())%mod+1;
}
public static vood main(String[] args){
int[][] a = {{1,2,3},{4,5,6}};
for(int i = 0;i for(int j = 0;j System.out.println("a["+i+"]"+"["+j+"] :"+a[i][j]);
}
}
Integer[][] a1 = {{new Iteger(1)},new Integer(2)},
{new Integer(3),new Integer(4)},
{new Integer(5),new Integer(6)}
};
for(int i = 0; i for(int j = 0;j System.out.println("a1["+i+"]"+"["+j+"] :"+a1[i][j]);
}
}
Integer[][] a2;
a2 = new Integer[3][];
for(int i = 0;ia2[i] = new Integer[3];
for(int j = 0;ja2[i][j] = new Integer(i*j);
}
}
for(int i = 0;ifor(int j = 0;j System.out.println("a2["+i+"]"+"["+j+"] : "+a2[i][j]);
}
}
}
}
以上为程序源代码,请专家看看,问题出在哪里,我JAVAC了几遍都不行,自己初学实在看不出问题在哪里,大家也可推荐下JAVA初学者的论坛给我,谢谢大家了
/6 : public static vood main(String[] args){
/7 : int[][] a = {{1,2,3},{4,5,6}};
/8 : for(int i = 0;i/9 : for(int j = 0;j<漏灶a[i].length;j++){
/10: System.out.println("a["+i+"]"+"["指裂+j+"] :"+a[i][j]);
/11: }
第9行 进行更返逗扮改。
我觉得没有这样的必要啊,实际引用当中几乎不用的。
← 上一篇: 下一篇: →