The toString() method of Year class in Java is used to return the string representation of this Year object.
public String toString()
Parameter: This method does not accepts any parameter.
Return Value: It returns the string representation of this Year object.
Below programs illustrate the toString() method of Year in Java:
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.