A. A record body may declare static fields and static methods, but not additional instance fields.Correct answer
Static members are exempt from the state restriction: a record body may freely declare static fields and static methods (counters, factories, constants). Only additional instance fields are forbidden, because a record's instance state is exactly its component list.
B. Declaring an explicit canonical constructor suppresses the generated accessors, which must then be written by hand.
Declaring an explicit canonical constructor suppresses only the constructor; the accessors, equals, hashCode and toString are still generated. Each implicit member is suppressed only by declaring that exact member, so this conflates independent generation rules.
C. A record may extend an abstract class, provided that class declares a no-argument constructor.
A record implicitly extends java.lang.Record, and since Java is single-inheritance the record grammar has no extends clause at all; the no-argument-constructor proviso is a red herring borrowed from ordinary class inheritance. A record may still implement interfaces.
D. A record class may be generic, so `record Pair<A, B>(A first, B second) {}` is a valid declaration.Correct answer
Records are ordinary generic-capable classes: the header may carry type parameters, so record Pair<A, B>(A first, B second) {} compiles and behaves as expected.
Explanation
A record's instance state is exactly its component list, and nothing may be added to it — but that restriction applies only to INSTANCE fields. Static fields and static methods (counters, factories, constants) are unrestricted, which is why `A record body may declare static fields and static methods, but not additional instance fields.` is correct. Records are also ordinary generic-capable classes: the header may carry type parameters, so `record Pair<A, B>(A first, B second) {}` compiles and behaves as you would expect, making `A record class may be generic...` the second correct statement.
Why the others are wrong:
`A record may extend an abstract class, provided that class declares a no-argument constructor.` encodes the belief that a record is a normal class with a shorthand header, so ordinary inheritance rules apply. Every record implicitly extends `java.lang.Record`, and since Java is single-inheritance the record declaration grammar has no `extends` clause at all — the no-arg-constructor proviso is a red herring borrowed from ordinary class inheritance. (A record may still IMPLEMENT interfaces.)
`Declaring an explicit canonical constructor suppresses the generated accessors, which must then be written by hand.` confuses two independent generation rules. Writing a constructor only suppresses the generation of the constructor; the accessors, `equals`, `hashCode` and `toString` are still generated. Each implicit member is suppressed only by explicitly declaring THAT member.
Exam tip: keep the four generation rules separate — component fields, accessors, canonical constructor, and the trio of `equals`/`hashCode`/`toString` are each generated unless you declare that exact member yourself. And remember the asymmetry on membership: `extends` never, `implements` freely, `static` members yes, instance fields no.