aspose file tools
The moose likes Beginning Java and the fly likes Passing String for an object name Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "Passing String for an object name" Watch "Passing String for an object name" New topic
Author

Passing String for an object name

Joseph Russell
Ranch Hand

Joined: Jan 08, 2001
Posts: 290
Is it possible to do this:

Randall Twede
Ranch Hand

Joined: Oct 21, 2000
Posts: 4089
Im not certain. The best thing to do when you have questions like this is to just try it. Try replacing
// Other goodies....
with something like this:
foo.add(new java.awt.Button("bar");
and see if you get a compile error.
I might even try it myself


SCJP
Joseph Russell
Ranch Hand

Joined: Jan 08, 2001
Posts: 290
I was getting an error. I think my problem was that I was attempting to name my object from an instance variable inside the method.
Joe
 
jQuery in Action, 2nd edition
 
subject: Passing String for an object name
 
Similar Threads
difference b/n Class.newInstance and new
still a GC question ,help
navigator.plugins array
Instantiate a generic parameter type
How can I create an object based on input