The toString() method of LocalTime class is used to represents this time as a String, such as 20:15:34.111.
Following ISO-8601 formats are used for representation:
This method is derived from the Object Class and behaves in a similar way.
public String toString()
Parameters: This method accepts no parameter.
Return value: This method returns a String representation of this LocalTime.
Below programs illustrate the toString() method:
LocalTime : 19:34:50.630
Old LocalTime: 01:00:01 New LocalTime: 11:00:01
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.