Duration: 16:19 minutes
Summary: In this video, we are continuing the first set of the exam questions. We start with a question that covers class inheritance (extend). One important point to remember is that you can have a parent class pointing to a child (an Employee referencing an HourlyEmployee). But, for the other way around, you need to cast to the appropriate class. On the second question, we discuss the fact that only instance methods can be overridden, and calls to ‘super’ only apply to overridden methods. On the third question, we talk about is-a and has-a relationship. In has-a, we have a containment relationship (i.e. class A has classB). But for is-a, we are talking about inheritance (a Rectangle is-a Shape). Finally, we cover HashMaps. The trick to these questions is making sure you are using the correct method. In this case, the method ‘add’ was used instead of ‘put” which causes a compilation failure.