r/javahelp • u/IceCreamInsides • Sep 10 '26
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
}
1
Upvotes
1
u/Zakana_code Sep 10 '26
The best way I can think of solving this is by using an array tbh, add all the bools in it and run a for loop over it.