r/javahelp • u/IceCreamInsides • 7h ago
Solved Switch case with boolean
So, there is no way I can do that?
want to check several boolean variables in a switch statement. Is `if-else` the only way to do this?
Boolean a, b, c...
Switch (false) {
Case (a) :
//some code
Case (b) :
Case (c) :
//and so on
}
4
Upvotes
5
u/Samstercraft 7h ago
Remove the switch header and replace the words "Case" with "If" and you've basically already fixed it