WHAT IS THE PURPOSE OF TOSTRING() METHOD IN JAVA ?

Mayank Tripathi

Total Post:807

Points:4035
Posted by  Mayank Tripathi
Java  String 
 623  View(s)
Ratings:
Rate this:
  1. Mayank Tripathi

    Post:807

    Points:4035
    What is the purpose of toString() method in java ?

    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.

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!