Files
java-core-examples/copying/src/broken/WithExpression.java
T

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);
}
}