OK so what if i have a method like:
Object[] myTest(int[] a, double[] b){
return new Object[]{a,b};
}
Now How can i cast the result Object to int[] and double[]?
Like if i use:
int[] array1 = (int[]) myTest(a,b)[0];
double[] array2 = (double[]) myTest(a,b)[1];
But this does not work. Or is there any efficient method to do this job?
Not sure why you’re having difficulty: on Java 6 this works as expected.
Try compiling this class and running it:
it will print out
That’s the autoboxing taking place, but will still work.