嗨,我是几个小时老,Java是新的准确。我写了下面的代码,并收到以下错误 -当使用Array.Equals()编译错误被抛出
Exception in thread "main" java.lang.Error: Unresolved compilation problems: The method Equals(int[][], int[][]) is undefined for the type Arrays The method deepequals(int[][], int[][]) is undefined for the type Arrays
at App.main(App.java:28)
的代码如下以供参考。让我知道我是否缺少任何东西。提前致谢。
public class App {
static final int ROWS=2;
static final int COLS=2;
public static void main(String[] args) {
int bhade[][]=new int[ROWS][] ;
int bhade2[][]=new int[ROWS][];
bhade[0]=new int[COLS];
bhade[1]=new int[COLS];
bhade[0][0]=1;
bhade[0][1]=2;
bhade[1][0]=3;
bhade[1][1]=4;
bhade2[0]=new int[COLS];
bhade2[1]=new int[COLS];
bhade2[0][0]=1;
bhade2[0][1]=2;
bhade2[1][0]=3;
bhade2[1][1]=4;
System.out.println(bhade==bhade2);
System.out.println(bhade.equals(bhade2));
System.out.println(Arrays.Equals(bhade,bhade2));
System.out.println(Arrays.deepequals(bhade,bhade2));
}
};
只是一个猜测,但如果有的话,它可能是'Arrays.equals'以小写'e'。 – nhgrif
是和'deepEquals'大写的'E'现在对我来说很有用 – jgon
我不认为这会引起任何问题,但底部的分号是什么? – PakkuDon