• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

toString()

 
Surya Bavirti
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what is the need for overriding toString()?
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What does the Object class toString() method API tell you ?
 
ruban raj
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The toString method is widely implemented. It provides a simple, convenient mechanism for debugging classes during development. It is also widely used for logging, and for passing informative error messages to Exception constructors and assertions


Regards,
Vasiammal.p
 
Rob Spoor
Sheriff
Pie
Posts: 20611
63
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's also what is displayed by default in tables, lists and trees in Swing and AWT.
 
vijay makam
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As you yourself have rightly used the word "need" if you want to print a descriptive information about your object then you will override toString method.
 
Surya Bavirti
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks to All My Friends
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic