A character in Java is a single letter (so to speak), so '<='
, '&&'
, etc. won't work. If you need to put more than one character, then you have to use a String
: "<="
noticing the double quotes.
But then again, in Java you can't switch on a String
value unless you're using Java 7+. If that is not the case, then you'll have to use plain old if-else if
statements for performing the comparisons.