Hi everyone,
Scanner input = new Scanner();
for(i = 0; i < 5; i++){
if(counter == 5){
System.out.print("\nFirst class is full. Would you like to be put in economy class? (Yes or No): ");
String s = input.nextLine(); // Why it doesn't wait for input from user?
if(s == "yes")
choice = 2;
else if(s == "no")
System.out.print("Next flight leaves in 3 hours");
counter = 0;
}
while(array[counter] == false){
array[counter] = true;
displayBoardPass(1);
counter = 0;
}
break;
}
why when the program reaches the line
String s = input.nextLine();
it doesn't stop and wait for input from the user? It was supposed to wait for "yes" or "no" but instead it just continues executing the rest of the code.
Thanks in advance.
Edited by: blias on Dec 10, 2010 3:15 PM