This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I have an intuitive grasp on why the output of the following code is what it is. The output is: -434. The study guide mentions that overloaded var-args methods are chosen last. Can someone please provide me with or point me to the hard and fast rules regarding which overloaded methods are invoked?
The compiler chose the one which is nearest to a method call !
Like here, the confusion is between
But any array extends Object class so , here compiler chose 2nd method with Object as parameter , the first with var-args will be chosen If only when no other defined method matches OR the arguments are of same type but more than once passed to method !
Second call is straight forward,
In second call , the the 7 is auto boxed into Integer and passed as Object !