Java application if/case recommendation

Posted by Jesse on Stack Overflow See other posts from Stack Overflow or by Jesse
Published on 2009-07-22T22:55:22Z Indexed on 2010/05/09 5:18 UTC
Read the original article Hit count: 206

I am writing an application for a Java course. I am a complete beginner and am just going off material I have learned from the course and from the web. The application is exhibiting some behavior and I am not sure what is causing it. The application is GUI based and does calculations on user input. For the action listener section, I have a set of If statements such as: "if this button do this if this button do this"

All in a row like that. It seems as if the application is running ALL the if statements instead of running the one that corresponds with the button pressed.

Would I be better off using a case/switch structure for this sort of thing?

I can post my code if necessary, I am new around this site and am not sure if that thing is acceptable.

© Stack Overflow or respective owner

Related posts about java

Related posts about switch-statement