Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Passing String for an object name

 
Joseph Russell
Ranch Hand
Posts: 290
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible to do this:

 
Randall Twede
Ranch Hand
Posts: 4371
3
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Joseph Russell
Ranch Hand
Posts: 290
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic