I used this code. I am confused why this int array is not converted to an object vararg argument:
class MyClass {
static void print(Object... obj) {
System.out.println("Object…: " + obj[0]);
}
public static void main(String[] args) {
int[] array = new int[] {9, 1, 1};
print(array);
System.out.println(array instanceof Object);
}
}
I expected the output:
Object…: 9
true
but it gives:
Object…: [I@140e19d
true