I am preparing for a SCJP exam and when studying widening part it's given that widening beats both Boxing and Var-args in overloading but there is no clear explanation. Tried searching but didnt get any better answer.
One answer i got is because the compiler chooses the older style before it chooses the newer style. But I am not convinced.
Edit: I know widening is preferrd than boxing and var-args. but WHY is my question. of which i know one. any other reasons.
Here is an example of it:
So all this means is that it will widen before autoboxing and using varargs. If we took out the method of widen with the long parameter, it would have chosen the autoboxing before the varargs.