Return to site

JAVA CERTIFICATION QUESTION: Code readability and a Java record’s compact canonical constructor

=>A major focus of the record syntax is succinct code.

June 8, 2022

Imagine you’re working on a new time manipulation framework and you created the following record, which represents a time interval:

 

Your colleague has credibly mentioned that the user might create an interval with negative minutes, which does not make sense.

Which code fragment added at line n1 addresses this problem best? Choose one.

A)

 

B)

 

C)

 

D)

 

 

 

 

 

 

 

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