我得到一个错误,当我试图测试比较文件使用的健身和得到这个错误。
无法调用的构造函数 compare[0]
使用的适应度错误 Java
以及 maven
.
维基page:-
错误
我的java代码:
public class compare {
private String File1, File2;
public void setFile1(String File1) {
this.File1 = File1;
}
public void setFile2(String File2) {
this.File2 = File2;
}
public boolean quotient() throws IOException {
ArrayList al1 = new ArrayList();
ArrayList al2 = new ArrayList();
BufferedReader CSVFile1 = new BufferedReader(new FileReader("File1"));
String dataRow1 = CSVFile1.readLine();
while (dataRow1 != null) {
String[] dataArray1 = dataRow1.split(",");
for (String item1: dataArray1) {
al1.add(item1);
}
dataRow1 = CSVFile1.readLine(); // Read next line of data.
System.out.println(al1);
}
BufferedReader CSVFile2 = new BufferedReader(new FileReader("File2"));
String dataRow2 = CSVFile2.readLine();
while (dataRow2 != null) {
String[] dataArray2 = dataRow2.split(",");
for (String item2: dataArray2) {
al2.add(item2);
}
dataRow2 = CSVFile2.readLine(); // Read next line of data.
System.out.println(al2);
}
Object[] arr1 = {
al1
}; // arr1 contains only one element
Object[] arr2 = {
al2
};
if (Arrays.equals(arr1, arr2)) {
return true;
} else {
return false;
}
}
}
暂无答案!
目前还没有任何答案,快来回答吧!