This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes object name to string variable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "object name to string variable" Watch "object name to string variable" New topic
Author

object name to string variable

aseem agarwal
Greenhorn

Joined: Oct 17, 2009
Posts: 9
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

Joined: Jul 26, 2007
Posts: 10426
    
    8

Not Swing related. Moving.


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
aseem agarwal
Greenhorn

Joined: Oct 17, 2009
Posts: 9
can you explain what you want to say...
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39084
    
  23
Only by reflection.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39084
    
  23
aseem agarwal wrote:can you explain what you want to say...
You had posted in the wrong forum.
pete stein
Bartender

Joined: Feb 23, 2007
Posts: 1561
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.
 
GeeCON Prague 2014
 
subject: object name to string variable