My understanding of the implementation of the body method:
created a reference variable with the name month and type Month , then called the object now() method, i.e. assigned the current month, which is obtained from the system. Then in the condition we compare the month which was obtained by the now() method and the month from enum Month .
Question 1:
How the getMonth() method is implemented, and in general the construction Month month = LocalDate.now().getMonth(); My guess is that when the now() method gets the current date, this date is converted to the enum type, and then the assignment and further execution of the if takes place. Is my understanding of this problem correct?
Question 2:
Month month = LocalDate.now().getMonth(); I know that you can call a method using Object.method() , but like in this example, we have the Object.method().method() construct. How can you call two methods at the same time, and where to read about it.
Thank you for your help.
static boolean isSummer() { Month month = LocalDate.now().getMonth(); if (month == Month.JUNE || month == Month.JULY || month == Month.AUGUST) { return true; } else { return false; }