+ 1

how to make a case switch with String

switch case with String

15th Oct 2017, 5:21 PM
Brayan PĂ©rez Ramos
Brayan PĂ©rez Ramos - avatar
2 Answers
+ 10
// For Example : switch (your_string_var) { case "Hi": System.out.print("Hello"); break; default: System.out.print("Bye"); }
15th Oct 2017, 5:41 PM
Dev
Dev - avatar
+ 1
When you say "case", follow up by an actual String; for example, ... case "Hi": ....
15th Oct 2017, 5:27 PM
Quantallax