- To compare Strings use
.equals()
and not==
, unless you really know what you are doing.
inpText != "stop" //Not recommended !"stop".equals(inpText) //recommended
- You cannot use a String in a switch unless you are using jdk 1.7+.
Cannot switch on a value of type String for source level below 1.7. Only convertible int values or enum variables are permitted