A community for students.

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

anonymous

  • 5 years ago

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');

  • This Question is Closed
  1. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    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.

  2. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    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.

  3. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    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.

  4. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    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

  5. Not the answer you are looking for?
    Search for more explanations.

    • Attachments:

Ask your own question

Sign Up
Find more explanations on OpenStudy
Privacy Policy

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...

23

  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.