Java OCA OCP Practice Question 743

Question

Which is not a true statement about the Period class?

  • A. A Period is immutable.
  • B. A Period is typically used for adding or subtracting time from dates.
  • C. You can create a Period representing 2 minutes.
  • D. You can create a Period representing 5 years.


C.

Note

The Period class creates immutable objects and is usually used to add/subtract from a LocalDate or LocalDateTime object.

It allows creating date, week, month, or year periods.

Since it cannot be used for time, Option C is the answer.




PreviousNext

Related