A[] matches both A[]... and Object. Varargs is only used if no other method matches. That is why sifter(aa) uses Object and not A[]... It's also why B[] is used and not B[]...
Finally, 7 matches nothing directly. It is therefore boxed to Integer which then matches Object.
Which Kathy Sierra book? You should always quote your sources. And "Explanation ...." doesn't tell us much of what the thread is about.
Vasiq Molvizadah
Ranch Hand
Joined: Dec 24, 2009
Posts: 66
posted
0
Campbell Ritchie wrote:Which Kathy Sierra book? You should always quote your sources. And "Explanation ...." doesn't tell us much of what the thread is about.
The name of the book is SCJP for Java 6 Study Guide - by Kathy Sierra and Bert Bates and I apologize for not giving a proper thread name.....
Vasiq Molvizadah
Ranch Hand
Joined: Dec 24, 2009
Posts: 66
posted
0
Rob Prime wrote:A[] matches both A[]... and Object. Varargs is only used if no other method matches. That is why sifter(aa) uses Object and not A[]... It's also why B[] is used and not B[]...
Finally, 7 matches nothing directly. It is therefore boxed to Integer which then matches Object.
Thanks for the explanation Rob.....
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32686
4
posted
0
Thank you for the information, and apology accepted.