Java – “a value of type string cannot be opened below the source level..” error

I am using eclipse to develop a java program I had to downgrade JRE and JDK from 1.7x to 1.6 Now everything points to 1.6 X (including installed JRE and JDK compatibility)

But now eclipse still gives me an error in the switch statement, pointing out:

In the following code:

Switch("test") // Which is fine with 1.7.x

I deleted 1.7.0 from my computer x. I don't know why I'm still looking for 1.7 instead of 1.6?

Solution

String switches are introduced in Java 1.7

When you downgrade to Java 1.6, an error message appears In this release, you can only open primitive types and enumerations

Related questions:

> Why can’t I switch on a String?

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>