代码:
ArrayList <Integer> marks = new ArrayList();
String output = "Class average:" + calculateAverage() + "\n" + "Maximum mark:" +
calculateMaximum() + "\n" +"Minimum mark:" + calculateMinimum() + "\n" + "Range of
marks:" + range;
analyzeTextArea.setText(output);
private double calculateAverage(double [] marks) {
double sum = 0;
for (int i=0; i< marks.length; i++) {
sum += marks[i];
}
return sum / marks.length;
}
忽略字符串中的其他内容(最小值、最大值和范围),但对于这一行,
String output = "Class average:" + calculateAverage() + "\n" + "Maximum mark:" +
calculateMaximum() + "\n" +"Minimum mark:" + calculateMinimum() + "\n" + "Range of
marks:" + range;
我收到一个错误:
必需:双 []
找到:无参数
为什么我会收到这个错误,我应该改变什么?