I'm bit confusing in the way overloading works with widnening, Autoboxing, and Varargs, I tried to understand the concept as much as i can but there is still some cases I can't get the way of generating the output of them.
I need to understand the output of the follow example
public static void main(String[] args){
int[] x = new int[3];
Integer[] y = new Integer[5];
doStuff(x);
doStuff(y);
doStuff(null);
}
static void doStuff(Object... x){
System.out.println("Object...");
}
static void doStuff(Object x){
System.out.println("Object");
}
The output is :
Object
Object...
Object...
Can anyone help me understanding how this output is generated? I tried to search and read a lot using google and reading answers related to this topic in this site, but can't reach the point till now.
Thanks in advance,