, , .
, , , "". , , , . Anyhoo...
:
someField cannot be resolved
, , "" . - , , , .
main(). . , answerKey studentAnswers, . - , , . answerKey, studentAnswers , :
public static String[] getData() throws IOException {
String[] studentAnswers = new String[50];
String answerKey = strTkn.nextToken();
}
, , studentAnswers answerKey " getData()". , main().
- - , public static String answerKey; public class GradeResults {, , , ( , ).
- "" . , , , , . , ( , ). , , , Student.
public class Student {
private int id;
private String answers;
public Student(int newStudentsId, String newStudentsAnswers) {
this.id = newStudentsId;
this.answers = newStudentsAnswers;
}
}
, , :
Incompatible operand types String and char
:
public static int gradeTally(String[] letterGrade) {
if(letterGrade[i] == 'A') a++;
, letterGrade[i], , 'A' char.
'A' "A", , char, double String. :letterGrade char[] letterGrade, ( ).
, :
Cannot invoke charAt(int) on the primitive type int
:
total = studentAnswers[i].charAt(a);
charAt - String, studentAnswers[i] String. int[] studentAnswers, " ".
, , . - Java ( Objects First With Java) , .