Use string in switch case in java - Stack Overflow
Java (before version 7) does not support String in switch/case. But you can achieve the desired result by using an enum. private enum Fruit { apple, carrot, mango, orange; } String value; // assume input Fruit fruit = Fruit.valueOf(value); // surround wit...