Question: In Module 3, you learned about Java interfaces and polymorphism. In order to implement polymorphic method calls to a method named poly() which is

In Module 3, you learned about Java interfaces and polymorphism. In order

In Module 3, you learned about Java interfaces and polymorphism. In order to implement polymorphic method calls to a method named poly() which is declared in a superclass Super and in the direct and non-direct subclasses of Super, we must write the code in a specific way. There are also other important polymorphism facts to know, so this questions is a bit of a catch all. There are several statements below, some of which are true and the others are false. Select all of the true statements. Within the method that is generating the polymorphic method calls, the polymorphic method that gets called is the one associated with the class of the actual object that the object variable refers to, not the class of the object variable. For each subclass of Super in which we intend to polymorphically call poly(), the subclass must override poly(). If poly () is declared as abstract in Super(), then it must also be declared as abstract in every subclass of Super. In Super, poly() must be declared as an abstract method. It is legal to substitute an object of a superclass in a location where an object of one of its subclasses is declared. Polymorphism is useful because it often permits us to write much simpler and more extensible code than what we would write if Java did not support polymorphism. In Java, a polymorphic method call is implemented using a technique known as dynamic method lookup. It is legal to substitute an object of a subclass in a location where an object of its superclass is declared. For each subclass of Super in which we intend to polymorphically call poly(), the subclass must overload poly(). Within the method that is generating the polymorphic method calls, the data type of the objects on which we are making the calls will generally be Super or some subclass of Super (which is essentially acting as Super for its subclasses). Super must be declared as an abstract class.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

The detailed answer for the above question is provided below Here are the true statements from the o... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!