Home > DeveloperSection > Interviews > What is the purpose of toString() method in java ?

Posted on    April-27-2015 12:32 AM

 Java Java  String 
 1 Answer(s)
  544  View(s)
Rate this:

Mayank Tripathi
Mayank Tripathi

Total Post:807

Posted on    April-27-2015 12:32 AM

The toString() method returns the string representation of any object. If you print any object, java compiler internally invokes the toString() method on the object. So overriding the toString() method, returns the desired output, it can be the state of an object etc. depends on your implementation.

Don't want to miss updates? Please click the below button!

Follow MindStick