Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b4BL3cEPHQTk2McE7C
12 lines
320 B
Java
12 lines
320 B
Java
/** A "wither" expression on a record (JEP 468, derived record creation). Not part of JDK 25. */
|
|
public class WithExpression {
|
|
|
|
record Point(int x, int y) {}
|
|
|
|
public static void main(String[] args) {
|
|
Point p = new Point(1, 2);
|
|
Point q = p with { x = 10; };
|
|
System.out.println(q);
|
|
}
|
|
}
|