Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem in my switch case

 
Marianne Hathaway
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi guys...please. check this one.. I'm new to java and I need some help in here. I'm have a problem with this:


My problem is: If I only choose Budget Meal ...that Regular Meal is also showing.. and I can't choose. please help me. Im all messed up. I cant think of any solution. My codes are always showing whichever I choose. You can ask me if you're kinda confused

 
Tony Docherty
Bartender
Posts: 2969
59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch.

Please UseCodeTags (← click) when posting code as it makes it easier for people to read your code. I've added them for you this time.
 
Tony Docherty
Bartender
Posts: 2969
59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your if statements both have semi-colons after them so the following code block is not part of the if statement and will always get executed.
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tony Docherty wrote:Your if statements both have semi-colons after them so the following code block is not part of the if statement and will always get executed.

Well spotted.
 
Marianne Hathaway
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks....I'm sorry for that code tag thing...^_^. I dont know the rules ,eh.
 
Marianne Hathaway
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Marianne Hathaway wrote:hi guys...please. check this one.. I'm new to java and I need some help in here. I'm have a problem with this:


My problem is: If I only choose Budget Meal ...that Regular Meal is also showing.. and I can't choose. please help me. Im all messed up. I cant think of any solution. My codes are always showing whichever I choose. You can ask me if you're kinda confused

 
Tony Docherty
Bartender
Posts: 2969
59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've already told you what is wrong with your code, please see my earlier post. If you don't understand my earlier answer please ask for clarification don't just post the same question again.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic