Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

object name to string variable

 
aseem agarwal
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can i get the name of the object as a string

for e.g there is class student
and object is student s1;

i want s1 as string variable.....
 
Maneesh Godbole
Saloon Keeper
Posts: 11027
12
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not Swing related. Moving.
 
aseem agarwal
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can you explain what you want to say...
 
Campbell Ritchie
Sheriff
Posts: 48917
58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Only by reflection.
 
Campbell Ritchie
Sheriff
Posts: 48917
58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
aseem agarwal wrote:can you explain what you want to say...
You had posted in the wrong forum.
 
pete stein
Bartender
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
aseem agarwal wrote:can i get the name of the object as a string

It kind of begs the question of why you want to do this. There are valid reasons for doing this, but sometimes it's a symptom of a broken design.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic