aspose file tools*
The moose likes Beginning Java and the fly likes Explanation .... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Explanation ...." Watch "Explanation ...." New topic
Author

Explanation ....

Vasiq Molvizadah
Ranch Hand

Joined: Dec 24, 2009
Posts: 66
I'm reading this Kathy Sierra Book and in one program...the output is kinda confusing...



The output of the program is
-434

I'm not getting this....any help


Human Knowledge Belongs to the World.
- Vasiq Mz
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19783
    
  20

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.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 40034
    
  28
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
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
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: 40034
    
  28
Thank you for the information, and apology accepted.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Explanation ....