Java error, Scanner cannot find symbol -
system.out.print("are sure want quit? (y or n)"); char selection; selction = sc.nextchar(); if(selection == 'y' || 'y'){ close = 1; }else if(selcetion == 'n' || 'n'){ break; }else{ system.out.println("invalid input"); } what wrong part of program. scanner initialized correctly in method on top.
here screenshot of errors.
http://i.stack.imgur.com/6na3l.png
change following(please notice spelling mistakes have committed):
char selection; selection = sc.next().charat(0); if(selection == 'y' || selection == 'y'){ close = 1; }else if(selection == 'n' || selection == 'n'){ break; }else{ system.out.println("invalid input"); }
Comments
Post a Comment