score:1

Accepted answer

download and install the current eclipse version. eclipse has a build-in java compiler. switching on strings was added in java se 1.7. java se 1.4 is a very old version of java. it's not a good idea to learn programming using a version of java which is that old.

also, as the other answer suggests, install the latest jdk.

score:0

your friend is correct in saying that it is because of a compiler compliance level. in order to be able to fix your problem, your compiler must be version 1.7 or 1.8. if you're using an ide, you'll need to download a jdk to match up to whichever version you need (would recommend 1.8 as it's not eol'd). if you're using maven, you can change your compiler level by using the maven compiler plugin.


Related Query

More Query from same tag