This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

toSting()

 
Noman Iqbal
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wanna know about that how the toString() method works. I want the answer with complete detail. And also that how to use this function. waiting or reply from any one.
bye
Noman Iqbal.
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well you are going to have a heck of a time getting ANY answer unless you give us some hint about WHAT CLASS you want to know about the toString() method of. There are about 4 zillion classes that have that method, and the answer changes depending on the class.

However as an example:
int i = 1232354345;
String s = Integer.toString(i);
Now s has a string representation of the integer value.
So what class did YOU want to know about?
 
Manfred Leonhardt
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Noman,
Since Cindy gave you a great example, I will provide the complete details. Since I tire easily, I will only give details on about 200-300 class (out of Cindy's 4 zillion). Maybe if you keep asking you can start a good collection. If you actually get all 4 zillion you get a new Mercedes (so I heard!).
Complete Details
Happy Reading!
Manfred.
 
sanno panno
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi , Noman
In response to your question i want to go on basics, Every class is extended from Object class implictly , and Object class has toString method so every class has a toString method.
While calling toString method using objects of any class returns String representation of that class.
whenever you print an object on console it's imlicit tostring method is called and returned value of toString method is printed on console.

Hope it will work.
 
rani bedi
Ranch Hand
Posts: 358
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Class Object is the root of the class hierarchy. Every class has Object as a superclass. All objects, including arrays, implement the methods of this class.
The toString() method returns a string representation of the object.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic