Can someone explain, how the answer is -434. Book explantion was ... In general, overloaded var-args methods are chosen last. Remember that arrays are objects. Finally, an int can be boxed to an Integer and then "widened" to an Object.
Hi Srinivas buddy,
When aa is passed to sifter, sifter(Object o) is chosen over sifter( A ... a2) because a var ags method is always the last choice.
When ba is passed, sifter(B b1) is chosen over sifter(Object o) because ba matches B type. Also, sifter(B ...b1) is a var ags method is always the last choice.
As Himai said, the precedence for method parameters are described in K&B books and that's are
3) Variable Args...
--> In sifter(aa) aa is A's array object , it can't do narrowing to convert it to B , it widening to Object (arrays are object) ,so its goes to sifter(Object o) ans set 4
--> In sifter(ba) ba is B's array ojbect, so it goes compatible with sifter(B b1) and ans set to 3
--> in sifter(7) , 7 is integer, in this case int box to Integer and then widening to Object so its goes to sifter(Object o) and ans set to 4