samedi 21 mars 2015

Java - Create instance of a class with String as name

I want to create some instances of class, just like:



Country ger = new Country();
Country usa = new Country();
...


and so on. Because I want to do this for a huge number of objects, I'd rather want to create those instances with instance names from a text file where those country tags are listed and iterate through this list. I am familiar with the Java reflection concept, however I DO NOT WANT to create a single class for each object as I just want to cut those declarations short.


Is there any way to do that?


Thanks in advance






Aucun commentaire:

Enregistrer un commentaire