I have similar problem.
Object[] myArray;
if(...){myArray={3,4,5};}
else(....){myArray={'a','b','c'};}
of course i can create new variables and cast to them;
Integer[] arrayInt; /// arrayInt=(Integer[])myArray;
Character[] arrayChar; ////............
but the problem is i wanna use one variable name in code after that. Only myArray!!!
1. Is there a way to change the type of given variable?
2. Or how to find variable type and use it for dynamical declaration?
for instance
<type of any variable> c= new <type constructor>
Probably getClass() is the answer but, how to use it?
[ March 29, 2008: Message edited by: judas123 ]