Before Java 7, switch could only support byte, short, char, int or their corresponding wrapper classes and Enum types. In Java 7, String support was added.
12345678910switch (ctrType) { case "01" : exceptionType = "Read FC parameter data"; break; case "03" : exceptionType = "Read the current meter data saved by FC"; break; default: exceptionType = "Unknown control code: "+ctrType; }where ctrType is a string.
If used in versions before jdk 7, the following error will be prompted:
Cannot switch on a value of type String for source level below 1.7. Only convertible int values or enum variables are permitted
It means that the jdk version is too low and not supported.