How many of the classes LocalDate, Period, and ZonedDate
have a method to get the year?
C.
The LocalDate class represents a date using year, month, and day fields.
There is a getYear()
method to get the year.
The Period class holds units of years, months, and days.
It has a getYears()
method.
There is not a date/time class called ZonedDate
.
There is a class called ZonedDateTime, which does have a getYear()
method.
Since only LocalDate and Period have a method to get the year, Option C is correct.