• Post Reply Bookmark Topic Watch Topic
  • New Topic

instance name  RSS feed

 
untak goel
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can we get the name of the instance of the class ?

???Object.tostring(); gives the encrypted name.


please tell me to get the proper name not the encrypted one.


Thanks
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Java objects don't have "names".

The toString() method returns whatever each individual class defines it to return. The version in java.lang.Object returns the name of the class together with a hexidecimal rendering of the value returned from the hashCode() method. Other classes can redefine it to return whatever they want.

What is it you want to do with this "name"?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!