Return to site

JAVA CERTIFICATION QUESTION: The syntax of generated record classes in Java

=>What type of accessor do you need to access a record’s fields?


· java,ocp

Given the record

public record Period (int aLength) { }

and the code fragment

var period = new Period(60);

Which code below is valid in the scope of the variable period? Choose one.

A. int i = period.aLength;

B. int i = period.aLength();

C. int i = period.getaLength();

D. int i = period.getALength();





·ꓭ uoᴉʇdo sᴉ ɹǝʍsuɐ ʇɔǝɹɹoɔ ǝɥꓕ ·uoᴉsnʅɔuoꓛ


All Posts

Almost done…

We just sent you an email. Please click the link in the email to confirm your subscription!