Java SE 8 Programmer II — Question 6
java.time.Duration?
Which statement is true about -
Answer options
- A. It tracks time zones.
- B. It preserves daylight saving time.
- C. It defines time-based values.
- D. It defines date-based values.
Correct answer: C
Explanation
The correct answer is C because java.time.Duration is specifically designed to represent time-based values, such as time intervals. Options A and B are incorrect since Duration does not deal with time zones or daylight saving time, as those are aspects of java.time.ZoneId and java.time.ZonedDateTime. Option D is also incorrect because Duration does not define date-based values, which are instead handled by classes like java.time.LocalDate.