wood burning stoves*
The moose likes Beginning Java and the fly likes Use of toString Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Use of toString" Watch "Use of toString" New topic
Author

Use of toString

Nelson Sam
Ranch Hand

Joined: Jun 12, 2010
Posts: 30
Hello all.

Can anyone tell me the usage of toString function.And also String toString method.
Thanks
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

default every class you write has object's toString() method which returns the name of the class followed by @hash value.
by overriding the toString method, you can return a more meaningful value to your class, such as attributes and their values

also it is very useful, when you debug by logging a class

hth
in Mkumar
Greenhorn

Joined: Sep 08, 2008
Posts: 20
I java, toString() method is used when we need a string representation of an object. It is defined in Object class.
More over, This method can be overridden to customize the String representation of the Object.

-Manoj
Martin Vanyavchich
Ranch Hand

Joined: Sep 16, 2008
Posts: 241
Strings toString() returns itself


SCJP 6, OCMJD 6, OCPJWSD 6
I no good English.
Nelson Sam
Ranch Hand

Joined: Jun 12, 2010
Posts: 30
Thank you friends
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Use of toString