There has been a long discussion on this these days here...
Thanks for pointing that out. Yes, I have been following that great discussion. In fact, this question is an offshoot of one of the posts in that discussion. Started a new topic, since it seemed a little OT to the original post.
I'm sorry, but can someone please explain this more.
In example 1, there is no widening involved, just boxing... if needed. Since a method call that takes a primitive variable(int) is present, the boxing is not needed either.
In example 2, there are two options - varargs only/ boxing + varargs. If in example 1, the method knows to go to the primitive method call, and not do the boxing needlessly, then why not the same in example 2. Yes, there is varargs also, but again the choice is between primitive and boxing so why not go just to primitive.
The question seems clear enough in my head, but not sure if I am being able to make sense!!!