how do I make this menu list work in java? System.out.println("Please Enter the choose option: "); optionChoose = input.nextInt(); switch (optionChoose) { case '1' : break; case '2' : break; case '3' : break; case '4' : break; default: System.out.println("Invaild Selection"); } }while(optionChoose != '4');
case '1': those are where I'm going to do the other methods. I want the program to exist when the user enter 4 which is case 4 to exist. But it doesn't work for some reason.
I am not an expert of Java but I noticed that you use nextInt() method but in the switch block you check against characters -- this may be a problem.
gentoolx could be right. try to leave out the apostrophs ' ... case 4 : break; ... because you check against characters and not int-values your exit-case can never become true.
Thank you guys so much. You guys are life savers. You guys are right about apostrophs. If I put the apostrophs, it would make it be an integer. Thank you so much again
Join our real-time social learning platform and learn together with your friends!