Page 617 K&B Qno.12 Why is the answer The code does not compile?
You cannot add a reference to an Object to a HashSet<Person>. You may only add a Person (or a subclass of Person).
Page 620 K&B Qno.16 Please explain how is this ques evaluated?
The return type is defined to be a List. You can't assign a List to an ArrayList reference. (The List reference may point to a List that is not of type ArrayList such as LinkedList.) So A and D are wrong.
C is wrong because output is List<Number> but the reference returned is a List<Integer>.
Java can't convert the reference like that.