Link Details

Link 543761 thumbnail
User 448255 avatar

By dotCore
via dreamincode.net
Published: Jan 12 2011 / 21:16

The toString() method solves so many question that we see these days in the forums, and it is crucially important to understand it. It is a method that is defined in the Object class and thus, every object has one, however, it prints out, for the most part, meaningless information.
  • 7
  • 0
  • 1995
  • 3

Comments

Add your comment
User 776377 avatar

lburnham123 replied ago:

0 votes Vote down Vote up Reply

Summary: override toString() to provide a string representation of an object.

User 405399 avatar

saifuddin.merchant replied ago:

0 votes Vote down Vote up Reply

I guess its more of a tip/tutorial for beginners - I would have loved to see a mention of org.apache.commons.lang.builder.ToStringBuilder - specifically the http://commons.apache.org/lang/api-2.5/org/apache/commons/lang/builder/ReflectionToStringBuilder.html

Add your comment


Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.

Voters For This Link (7)



Voters Against This Link (0)



    Java Performance Optimization
    Written by: Pierre-Hugues Charbonneau
    Featured Refcardz: Top Refcardz:
    1. Design Patterns
    2. OO JS
    3. Cont. Delivery
    4. Java EE7
    5. HTML5 Mobile
    1. Node.js
    2. Debugging JavaScript
    3. OO JS
    4. JSON
    5. Ajax