Home > Software design >  How to get Java 19 to recognize 'record' keyword
How to get Java 19 to recognize 'record' keyword

Time:10-08

I am using jdk 19 and want to make a record class for my Java project.

jdk 19

When I declare the class Person:

public record Person (String name) {}

I get the error

'class' or 'interface' expected

I don't understand why it will not let me use the record keyword.

Any help is appreciated

CodePudding user response:

The records feature arrived in Java 16.

Project language level is selected to be 15, why didn't you change?

  • Related