tech_logman
tech_logman

Reputation: 109

switch on string not working on jdk8

I know that 'switch' on strings was not workable before java 7 and was implemented only in java 7 and later. But I am using java 8 and I still get the error message "cannot switch on strings". Can anyone explain why and how do I get around it?

Upvotes: 0

Views: 667

Answers (1)

STaefi
STaefi

Reputation: 4377

Even if you are using JDK 8 it's possible that you are not using the java 8 compiler compliance level .

If you are on eclipse, you can set the compiler level like this:

enter image description here

Upvotes: 1

Related Questions