用Eclipse编译java代码,出现如下错误 新手求助!
import java.util.Random;public class hzq {
static Random rand=new Randow();
static int pRand(int mod){
return Math.abs(rand.nextInt())%mod +1;
}
public static void main(String[] args){
int[][] a={{1,2,3},{4,5,6}};
for(int i=0 ;i<a.length;i++){
for(int j=0 ;j<a.length;j++){
System.out.println("a["+i+"]"+"["+j+"]:"+a[i][j]);
}
}
integer[][] a1={{new integer(1),new integer(2)},{new integer(3),new integer(4)},{ new integer(5),new integer(6)}};
for(int i=0 ;i<a.length;i++){
for(int j=0;j<a[i].length;j++){
System.out.println("a1["+i+"]"+"["+j+"]:"+a1[i][j]);
}
}
Integer[][] a2;
a2=new integer[3][];
for(int i=0;i<a2.length;i++){
a2[i]=new integer[3];
for(int j=0 ;j<a2[i]; i++){
for(int j=0 ;j<a.length;j++){
System.out.println("a2["+i+"]"+"["+j+"] :"+a2[i][j]);
}
}
}
}
}
错误信息:
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
integer cannot be resolved to a type
integer cannot be resolved to a type
integer cannot be resolved to a type
integer cannot be resolved to a type
integer cannot be resolved to a type
integer cannot be resolved to a type
integer cannot be resolved to a type
integer cannot be resolved to a type
integer cannot be resolved to a type
The operator < is undefined for the argument type(s) int, Integer[]
Duplicate local variable j
at hzq.main(hzq.java:14) --------------------编程问答-------------------- new integer(3)
是
new Integer(3)
i要大写 --------------------编程问答-------------------- for(int i=0;i<a2.length;i++){
a2[i]=new integer[3];
for(int j=0 ;j<a2[i]; i++){
for(int j=0 ;j<a.length;j++){
============================
什么情况,麻烦楼主把你要的东西写清楚。 --------------------编程问答-------------------- for (int i = 0; i < a.length; i++) {
for (int j = 0; j < a[i].length; j++) {
System.out.println("a1[" + i + "]" + "[" + j + "]:" + a1[i][j]);
}
}
========================
问多不少,请楼主理清楚一下。
补充:Java , Java相关