Source: K&B Book.
public class Wrapper
{
static
String s="";
public static void main(String[] args)
{
int x=4;
Boolean y=true;
short[] sa={1,2,3};
dos(x,y);
dos(x);
dos(sa,sa);
System.out.println(s);
}
static void dos(Object o)
{
s+="1";
}
static void dos(Object... o)
{
s+="2";
}
static void dos(Integer... i)
{
s+="3";
}
static void dos(Long L)
{
s+="4";
}
}
Here,dos(sa,sa) invokes the method static void dos(Object... o), but shouldnt the method void dos(Integer.. i) be invoked instead??