Which statement is not true about these two variables?
Duration duration = Duration.ofDays(1); Period period = Period.ofDays(1);
toString()
.A.
Duration is used for units of time a day and smaller, making Option B a true statement.
Period is used for units of time a day and larger, making Option C a true statement.
While both represent the same length of time, they output different values when calling toString()
.
The Duration object outputs PT24H, and the Period object outputs P1D.
This shows that Duration is providing the ofDays()
method as a convenience instead of requiring the programmer to type 24 hours.
Option A is the answer.