scanner issue when copy pasted but the original program works
int x = 0; int y = 0;
/**modify grade*/
Scanner student = new Scanner(System.in);
System.out.print("Enter student ID:");
int studentId = student.nextInt();
switch (studentId){
case 1101:
Scanner course = new Scanner(System.in);
System.out.print("Enter course ID:");
int courseID = course.nextInt();
switch(courseID){
case 901:
x = 1;
y = 1;
Scanner change = new Scanner(System.in);
System.out.print("Enter new value:");
int newGrade = change.nextInt();
aryTable[x][y] = newGrade;//problem here
break;
break;
}
with the "newGrade;" it has a red underlined saying type mismatch, but
everything seems to be fine, even the 2 scanners used previously work. it
was just a copy paste, im confused as to why this is wrong? can i pls get
any help to make this valid? i am making a program that will get the
student, then get the course, then modify the corresponding grade.. i used
a 2-d array.. thanks and cheers
No comments:
Post a Comment