OCA Java SE 8 Mock Exam Review - OCA Mock Question 16








Question

Which of the following must be true for a method to support polymorphism?

  1. The method must override a base class method
  2. The method's class must extend a base class that has the overridden method
  3. The method must overload a base class method
  4. The method must execute against a base class reference variable




Answer



A and D

Note

Overloading only occurs within the same class. It is about two method with different signature. It is not necessary to have a base class.

A common implemented interface will also work for polymorphic behavior.