0
The input in switch statement can only be integer or others are also possible?
I tried to use character value and string value as input but getting error in execution
2 Réponses
+ 3
It is possible to use characters.
Can you show your code please?
0
public class Program {
public static void main(String[] args) {
char day = 'a';
switch(day) {
case a:
System.out.println("Monday");
break;
case b:
System.out.println("Tuesday");
break;
case c:
System.out.println("Wednesday");
break;
}
}
}
This is my program but showing error