Basically, the toString() function comes into play, when you want to represent any object as a string. Also, it will help you to make your code shorter by overriding the toString() method to the object class.
I hope this will help.
Want to know more about Java? Prefer this tutorial on Java Tutorial.
Want to become a Java expert? Join Java Course now!!