record (String name) { public MyRec { System.out.println("Constructing"); } public void doSomething() { System.out.println("Name is " + name); } public static void main(String[] args) { final MyRec rec = new MyRec("Hello"); rec.doSomething(); } }