Skip to content
Advertisement

Arrow in case statement supported from Java 14 onwards only Java compilation error

I am new to Java. I am using Eclipse IDE, using the following config:

JavaScript

I do have simple switch statement:

JavaScript

But I get compilation error as:

Arrow in case statement supported from Java 14 onwards only

Why is that?

Advertisement

Answer

Capturing my earlier comment as an answer for future reference: You should check the project properties and make sure you’re using Java 16 in the build path.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement