+ 1
error: variable answer might not have been initialized }while(answer == "Y"); \\ the error pointed at >a. HELP
System.out.printf("Do you want to look on another Account? (Y/N)"); answer = input.next(); if(answer == "N") System.out.printf("Thank you, the program will exit now, Goodbye"); } } }while(answer == "Y");
3 Answers
+ 3
Initialize 'answer variable first' as
String answer;
Also answer=="N" not work in Java.
== Used for refference comparision of strings.
Use answer.equals("N") instead of (answer=="N") for string comparisions...
+ 1
Got it, Thanks
0
You're welcome...