If it is given that both methods exist, which one will be used? In other words, does the compiler think that widening a primitive
parameter is more desirable than performing an autoboxing operation?
The answer is that the compiler will choose widening over boxing, so the output will be

long

The compiler will choose the older style before it chooses the newer style, keeping existing code more robust. So far we've seen that

Just remember that the var-args method is like a "looser" than the other method, in that it could handle invocations with any number of
byte parameters. A var-args method is more like a catch-all method, in terms of what invocations it can handle.
--------------------------------------------------------

Yes, no problem, The show() method needs an Car refernece, and BMW IS-A Car. You just remember, the show() method thinks it's getting an Car object, so it will only
ask it to do Car things, which of course anything that inherits from Car can do.
So, here the compiler widens the BMW reference to an Car, and the invocation succeeds.

The key point here is that reference widening depends on inheritance or we can say that the IS-A test. Because of this, it's not legal to widen
from one wrapper class to another, because the wrapper classes are peers to one another. For instance, it's NOT valid to say that Short IS-A Integer.

Here what happened:1) First the byte b was boxed to Byte object2) Now the Byte Object widened to Object because Byte is-A Object (Byte extends Object)3) And then we have type cast Object o to Byte and then print

But in previous code we were passing byte b to method go(Long x), where is-A test failed. So compiler generates error.

Now see the rules for overloading methods using widening,boxing and varargs...

1) Primitive widening uses the "smallest" method argument possible.2) Used individually, boxing and var-args are compatible with overloading.3) You CANNOT widen from one wrapper type to another. (IS-A fails.)4) You CANNOT widen and then box. (An int can't become a Long.)5) You can box and then widen. (An int can become an Object, via Integer.)6) You can combine var-args with either widening or boxing