File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Problem in my switch case Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Problem in my switch case" Watch "Problem in my switch case" New topic
Author

Problem in my switch case

Marianne Hathaway
Greenhorn

Joined: Mar 04, 2013
Posts: 5
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

Joined: Aug 07, 2007
Posts: 2410
    
  50
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

Joined: Aug 07, 2007
Posts: 2410
    
  50
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

Joined: Aug 05, 2005
Posts: 3742
    
  16
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.


Joanne
Marianne Hathaway
Greenhorn

Joined: Mar 04, 2013
Posts: 5
thanks....I'm sorry for that code tag thing...^_^. I dont know the rules ,eh.
Marianne Hathaway
Greenhorn

Joined: Mar 04, 2013
Posts: 5
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

Joined: Aug 07, 2007
Posts: 2410
    
  50
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem in my switch case