Return to site

JAVA CERTIFICATION QUESTION: Java records, constructors, and the canonical constructor

=>When you don’t create a constructor for records, Java creates it for you.

· java,ocp

Given the Period record

record Period (int minutes) {

  // add new code here


and this client code

var period = new Period();

What should be added at “// add new code here” to allow the client code to create a period with minutes set to zero? Choose one.

A. Period {

  minutes = 0;


B. Period() {

  this.minutes = 0;


C. Period() {



D. Period() {






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