The following code
public static void main(String[] args) {
fun(new Integer(1));
}
static void fun(Object ... a) {
System.out.println(a.getClass());
}
gives the output :-
class [Ljava.lang.Object;
What class is this?
An Object[] array.
To get the runtime type information:
a.getClass().isArray() -> true
a.getClass().getComponentType().getName() -> java.lang.Object
according to the JVM specifications it is simply an array of java.lang.Object:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With