Hi Devidas, Here's a possible explanation. In this case, there are 2 possibilities - while invoking wide_arg(i,i): 1.The compiler can either widen these numbers to long and call the method wide_vararg(long... x), or 2. The compiler can box them to an Integer and call the method wide_vararg(Integer... x)
Since both these ways are legal, the compiler is unable to pick one over the other and hence the result is ambiguous.
This has actually to do with the new features implemented as part of Java 1.5.
Var-args and auto-boxing are both new features introduced in Java 5.
As you are passing ints to the methods, they get confused to which method to call because both of these new features have the same priority.
If you had removed the method with long var-args and just had two longs in the method, and then called the method passing two ints, then int would be up-casted to long instead of being auto-boxed to Integer objects. This keeps Java backward compatible because if you have 1.4 and it ran fine and then you introduced auto-boxing or var-args methods, it will still keep running fine.
This is really creepy explanation, but try hard to understand. If you have KnB book that explains the concept in detail.