java - How to stop JOptionPane from choosing last case? -
So this is a matter of shortening my case.
Suppose, we have a joicepan with 3 buttons.
Boolean loopgmainfase = true; While (LoopGameInterface) {int selectGame = Geotepepan ... .. Switch (GameGail) {Case 0: Case 1: Case 2: System. EXT (0); }}
The problem is, when I click the second button (for example), it goes in the case of 1. This is right. But when code is executed inside 1, then it goes straight to 2 and instead of parsing my game, I exit from my program?
You have to add break
at the end of each case. This is true for all switch statements, and not when you are using a usagepaypane
Comments
Post a Comment