• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

are variable variable-names possible?

 
David Llewellyn
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a file which contains a list of URL's to class files. I'm reading this as a string into a URL and using URLClassLoader to load the URL's. However, there are many class URL's. and at the moment because I don't know any better I'm just hard-coding them in as class A,B,C etc.
is there a way I can use a variable to name another variable? This would make it much more straightforward and extensible.

Once again, cheers to all reading this
 
David Llewellyn
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
actually, that was probably stupid hehe. I think it'd be better if I just created a class array and read into each slot in the array.
Ignore the last post
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Array is good. Glad you found a solution!

A List or Set is open-ended so you can do very similar stuff without having to know the number of entries before you start. If you need logical names for each URL you could look at Map. I load a lot of configuration stuff into maps as name-value-pairs.
[ March 04, 2005: Message edited by: Stan James ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic