Year atMonth(Month month) method in Java
The atMonth(Month) method of Year class in Java combines the current year object with a month passed as parameter to it to create a YearMonth object.
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.
public YearMonth atMonth(Month month)
Parameter: This method accepts a single parameter month. It is the month-of-year to use. It takes a valid Month object and cannot be NULL.
Return Value: It returns a YearMonth object formed by the current year object and a valid month passed as parameter to the function.
Below programs illustrate the atMonth(Month month) method of Year in Java: