Εγγραφές

Παράδειγμα


public class RecordDemo {
    record Point(int x, int y) {}

    public static void main(String[] args) {
        var a = new Point(5, 12);
        System.out.println("Point " + a + " has magnitude "
                + Math.hypot(a.x(), a.y()));
    }
}