103k views
5 votes
Of the three Rules presented in the pre-reading material which of the following are required to make polymorphism possible in Java? Select one:

a. Rule 2 and 3
b. Rule 1 and 3
c. Rule 1 and 2
d. Rule 1,2 and 3
e. Rule 3
f. Rule 1
g. Rule 2

User Beanie
by
8.2k points

1 Answer

3 votes

Final answer:

In order to make polymorphism possible in Java, we need to adhere to Rule 1, Rule 2, and Rule 3.

Step-by-step explanation:

In order to make polymorphism possible in Java, we need to adhere to Rule 1, Rule 2, and Rule 3.

Rule 1 states that the classes must have an inheritance hierarchy, meaning they should be related through inheritance.

Rule 2 states that the methods with the same name should be defined in the parent and child classes, allowing for method overriding.

Rule 3 states that the objects should be accessed through the reference of their parent class, allowing for dynamic binding.

Therefore, the correct answer is d. Rule 1, 2, and 3.

User Dieseltime
by
9.0k points