Some people affectionately refer to toString() as the "spill-your-guts method," because the most common implementions of toString() simply spit out the object's state (in other words, the current values of the important instance variables).
Could somebody explain these lines?
Abimaran Kugathasan wrote:It's obvious & no need of explanation. But I need it on that para.
Shouldn't you thank someone on their effort instead of saying it was obvious and "no need" of it?? Isn't the paragraph self explanatory?? The toString method is generally used to display the current state of the object i.e. the values of different instance fields. Some people refer to it as "spill-your-guts"...
Welcome to java ranch.