I'm engaged in building something in Java 14.
I wrote a class named for PersonInJava14 shown below.
package recordexample;
public record PersonInJava14(String name, String gender, int age) {}
However, it throws an error like this.
Syntax error on token "record", record expected
The project is based on Java 14 and can be done essential settings to run it in Java 14.
Here is my setting part.

How can I fix it ?
It seems to be a problem with your Eclipse. You can download another version of Eclipse or try compiling it by console with the following command: javac.exe PersonInJava14.java --enable-preview
Hope you can solve you problem ;)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With