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.