Can anyone explain why is the output -434 ?
From Kathy & Bates
The explanation given in the text is as:
1.Overloaded var-args are chosen last [OK]
2.Arrays are objects [then for sifter(ba), shouldn't the output be 4, after all its the same as "sifter(aa)"]
3.An int can be boxed to an Integer and then "widened" to an Object.
Please always tell us where such examples come from.
Write down the values of the fields in that B class. That would appear to be the String s. Work out which methods are called, in which order. Are you calling the sifter() method with Objects, As or Bs or what? Remember that sort of qwuation will have special features to confuse you.