About Question enthuware.ocpjp.v21.2.3699 :
Posted: Mon Mar 03, 2025 5:59 am
Given:
Which of the following methods will be added automatically to this record?
None of the answers are correct because the compiled code looks like this:
Code: Select all
record Student(int id, String name) { }
Code: Select all
public String getName(){ return name; }
Code: Select all
public setName(String name){ this.name = name; }
Code: Select all
public final boolean equals(Object)
Code: Select all
public final int hashCode()
Code: Select all
public final String toString()
Code: Select all
public record Person(int id, String name) {
public Person(int id, String name) {
this.id = id;
this.name = name;
}
public int id() {
return this.id;
}
public String name() {
return this.name;
}
}