What is toString() method? or define toString() method?
Returns a string representation of the object.
In general, the toString method returns a string that "textually represents" this object.
The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method.
One of the standard methods defined in java.lang.Object is toString().
Syntax of toString() method?
public String toString()
Returns:
a string representation of the object.
How do you write your own toString methods?
toString() method example::