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

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -