+ 2
Can we use a conditional operator in 'switch' statement??
eg. switch(a==b)
5 Answers
+ 7
In Java, switch does not support boolean type(a==b will return a boolean value).
It can work with integer or character value(so you can do something like 1 for true, 0 for false OR 't' for true & 'f' for false using if statement, and then use it in switch statement).[it does not make much sence to do all this when it can be done using simple if else statement]
+ 3
No. You can simply use 'if' instead.
+ 1
Okkk thanks
+ 1
No