Java OCA OCP Practice Question 751

Question

What is the smallest unit you can add to a LocalTime object?

  • A. Second
  • B. Millisecond
  • C. Nanosecond
  • D. Picosecond


C.

Note

The minusNanos and plusNanos are the smallest units available, making Option C correct.

Option D is incorrect because LocalTime is not that granular.

Note that while you can add milliseconds by adding many nanoseconds, there isn't a method for it.

A millisecond is also larger than a nanosecond.

LocalTime is immutable. You can add time and it gets returned as a different object.




PreviousNext

Related