The toString() method of a LocalDate class is used to get this date as a String, such as 2019-01-01.The output will be in the ISO-8601 format uuuu-MM-dd.
public String toString()
Parameters: This method does not accepts any parameters.
Return value: This method returns String which is the representation of this date, not null.
Below programs illustrate the toString() 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.