Define default constructor for record
问题 I have a record and want to add default constructor to it. public record Record(int recordId) { public Record { } } But it created constructor with int param. public final class Record extends java.lang.Record { private final int recordId; public Record(int); //other method } How can we add a default constructor to a record? 回答1: To split hairs, you cannot ever define a default constructor, because a default constructor is generated by the compiler when there are no constructors defined, thus