do {
out.print("Which room to modify? ");
roomNum = myScanner.nextInt();
out.print("How many guests inside? ");
numGuests = myScanner.nextInt();
guestsIn[roomNum] = numGuests;
out.print("Do you want to modify another room? (Y/N)");
reply = myScannerReply.findInLine(".").charAt(0);
} while (reply == 'y' || reply == 'Y');
This is just a little exercise program that I'm doing to learn how to use java. (I'm studying on java for dummies, then I'll try to find something more complex )
Anyway I just don't understand why this do-while works the first time, then when it arrives at the
"Do you want to modify another room?" a NullPointerException error appears, ending the program.
Which room to modify? 3
How many guests inside? 2
Do you want to modify another room? (Y/N)y
Which room to modify? 2
How many guests inside? 3
Exception in thread "main" java.lang.NullPointerException
at FlexibleHotelRooms.main(FlexibleHotelRooms.java:28 )
Do you want to modify another room? (Y/N)Java Result: 1
Do you know why?
Thanks