why is here: arrayList = {firstName, lastName, ID, examValue, score}; gives an error?? The method should call a constructor which is Exam(String firstName, String lastName, int ID, String examType, int score), so what's is wrong with this method? Thanks in advance!
public static Exam[] readAllExams(Scanner s)
{
Exam[] arrayList = null;
String firstName = "";
String lastName = "";
int ID = 0;
String examValue = "";
int score = 0;
while(s.hasNext())
{
if(s.hasNextLine())
{
firstName = s.next();
lastName = s.next();
}
else if(s.hasNextInt())
{
ID = s.nextInt();
}
else if (s.hasNextLine())
{
examValue = s.nextLine();
}
else if (s.hasNextInt())
{
score = s.nextInt();
}
}
arrayList = {firstName, lastName, ID, examValue, score};
return arrayList;
}