Hi I have the following requirement.
I want to create variable number of String arrays in a method, based on the number of levels present. For e.g
I have the variable numOfLevels (int) received from a jsp page.
Based on this I want to create:
String[] level1;
String[] level2;
String[] level3;
String[] level4;
etc ...
I know my requirement can be handled with Hashmaps and I've finally resorted to doing that, but I'm curious as to how this can be achieved with reflection in Java.
Many thanks in advance.
Hmm like a commenter pointed out, an almost similar question was asked at http://stackoverflow.com/questions/1192534/is-there-away-to-generate-variables-names-dynamically-in-java/1192561
Thanks for the valuable inputs people!