The getYear() method of an LocalDateTime class is used to return the year field.This method returns the primitive int value for the year from MIN_YEAR to MAX_YEAR.
public int getYear()
Parameter: This method does not accept any parameter.
Returns: This method returns an integer value which is the primitive int value for the year from MIN_YEAR to MAX_YEAR.
Below programs illustrate the LocalDateTime.getYear() method:
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.