YearMonth lengthOfYear() method in Java with Examples
The lengthOfYear() method of YearMonth class in Java is used to return the length of year of this year-month object’s value in number of days. The value of the length of a year is either 365 or 366 based on whether the Year is leap or not.
public int lengthOfYear()
Parameter: This method does not accepts any parameter.
Return Value: It returns an integer value denoting the length of year in number of days.
Below programs illustrate the lengthOfYear() method of YearMonth in Java: