OCA Java SE 8 Mock Exam 2 - OCA Mock Question 32








Question

Given the following code, select the correct statements:

class Person {} 
class Employee extends Person {} 
class Doctor extends Person {} 
  1. The code exhibits polymorphism with classes.
  2. The code exhibits polymorphism with interfaces.
  3. The code exhibits polymorphism with classes and interfaces.
  4. None of the above.




Answer



D

Note

The code above does not define any method in the class Person that is redefined or implemented in the classes Employee and Doctor.

All three polymorphism concepts or design principles are based on a method, which is missing in these classes.