record Point(int x, int y) {
public String toText() {
return String.format("x = %d; y = %d", x, y);
}
public void move(int right, int down) {
x += right; //<-Error
y += down; //<-Error
}
}
var p1 = new Point(1, 2);
var str1 = p1.toText();
//str1 is "x = 1; y = 2"
System.out.printf("str1 is '%s'\n", str1);