+ 1
how to make a case switch with String
switch case with String
2 Answers
+ 10
// For Example :
switch (your_string_var)
{
case "Hi":
System.out.print("Hello");
break;
default:
System.out.print("Bye");
}
+ 1
When you say "case", follow up by an actual String; for example,
...
case "Hi":
....