JavaSyntax
Define a Record
Code example
record Point(int x, int y) {}Defines an immutable data class in one line.
In Java, define a record: defines an immutable data class in one line — record Point(int x, int y) {}
record Point(int x, int y) {}record Point(int x, int y) {}Defines an immutable data class in one line.
Use record Point(int x, int y) {}.
Use this pattern: record Point(int x, int y) {}
Yes. Use Copy code and adapt the example to your program.
No. The language syntax is the same across operating systems.