+ 1
Why does not switch condn work with char or any other one just only with int
In code play as provided in this app switch case works only with int values not with char or any other one
5 Answers
+ 2
Nishant Singh That's not correct.
try this:
char c = 'a';
switch(c){
case 'a': System.out.println("a");
break;
case 'b': System.out.println("b");
}
+ 1
You must be talking about Java. It works in C.
+ 1
Sonic In java switch works with int, char and enums.
+ 1
Denise robberg the code of switch you give me has 'a' this written in println box how it is working you have to write "a" to give msg.