YearMonth atEndOfMonth() method in Java
The atEndOfMonth() method of YearMonth class in Java is used to return a LocalDate of the last day of month based on this YearMonth object with which it is used.
public LocalDate atEndOfMonth()
Parameter: This method does not accepts any parameter.
Return Value: It returns a Local Date with the last day of the current month as specified by this YearMonth object. This method does not returns a NUll value.
Below programs illustrate the atEndOfMonth() method of YearMonth in Java:
Program 2: This method also take cares of Leap Years.
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.