This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
The 'toString' method is inherited by all classes, and is originally defined in the Object class (the super parent of all objects/classes). The toString() method needs to be over-ridden (this means to replace the super-classes method definition with your own - just like when you write an applet, you over-ride the init(), start(), and paint() methods with methods to do something else you want). The original definition of toString() doesn't do too much (I'm not sure what it does at all). When you over-ride it in a program, you define how you would like YOUR data converted to 'String' data. For example, you may want to convert date/time data into a format you prefer.
One thing to know also is this: whenever you concatenate a String with any other object, an implicit call is made to the 'toString()' method. Keep this in mind if you over-ride 'toString()' and then can't figure out why you're strings look so different than you might be used to!
David - still nothing to say
-nothing important to say, but learnin' plenty-
Joined: Feb 05, 2003
Let me add that you'll get more help if you conform to the naming rules, i.e. use your name or at least one that sounds real.