Java OCA OCP Practice Question 1807

Question

How many of the classes Duration, LocalDateTime, and LocalTime have the concept of a time zone?

  • A. None
  • B. One
  • C. Two
  • D. Three


A.

Note

The Duration class is used to reflect an amount of time using small units like minutes.

Since it just uses units of time, it does not involve time zones.

The LocalTime class contains units of hours, minutes, seconds, and fractional seconds.

The LocalDateTime class contains all the data in a LocalTime and adds on a year, month, and date.

Neither of these classes uses time zones.

There is a ZonedDateTime class when you need to use time zones.

Since none of the three classes listed includes a time zone, Option A is correct.




PreviousNext

Related