Possible Duplicate:
Can a single Java variable accept an array of either primitives or objects?
I want to create an method that accepts either an arbitrary array. The array can be an array of primitives, or an array of objects.
Unfortunately, I can't do
public void myMethod(Object[] a) {...}
because primitives aren't objects! Is there a way to abstract this one level further?
EDIT I understand that I can pass it as an Object, but then how do I access it as an array within the method? I can't do:
public void myMethod(Object[] a) {
Object something = a[0];
}