Since I have multiple String cases which should be handled the same way, I tried:
String
switch(str) { // compiler error case \"apple\", \"orange\", \"
You got error because you used comma between case queries. To define multiple cases, you have to use semi colon so like this.
switch (str) { case "orange": case "pineapple": case "apple": handleFruit(); break; }