Challenge 1: A Person Record With Free equals()/toString() — Possible Solution ==================================================================== RecordDemo.java: public class RecordDemo { record Person(String name, int age) {} public static void main(String[] args) { Person p1 = new Person("Alice", 30); Person p2 = new Person("Alice", 30); System.out.println("Equal: " + p1.equals(p2)); System.out.println("toString: " + p1); } } Output: Equal: true toString: Person[name=Alice, age=30] Explanation: Declaring `record Person(String name, int age) {}` alone generates a constructor taking both fields, accessor methods name()/age(), and correct equals()/hashCode()/toString() implementations -- all without writing a single line of that code. p1 and p2 are two distinct object instances holding identical values, and the generated equals() (which compares field values, not references) correctly reports them as equal, exactly per java2-2's own equals()/hashCode() contract, but without ever hand-writing either method. WHY THIS WORKS AS AN ANSWER ------------------------------ This demonstrates the chapter's own core claim -- constructor, accessors, equals(), and toString() all generated from a single-line record declaration -- with no manual implementation of any of them anywhere in the code.