For example, say I wanted to \"extract\" String[] fruits = {\"Pear\", \"Banana\", \"Apple\"}; into three separate variables, eg:
for (int i=0; i
You're not going to be able to modify a class that's already been loaded into the JVM. However, you could conceivably use ASM < http://asm.ow2.org/ > or BCEL < http://commons.apache.org/bcel/> to dynamically generate a new class that has the dynamically-defined fields.
Way more trouble than it's worth. Seriously, just use a HashMap!