Question: Answer some java questions (Multiple Choice) : about polymorphism Question 1: A variable is declared with a superclass/parent type and initialized with a subclass/child type.

Answer some java questions (Multiple Choice) : about polymorphism

Question 1:

A variable is declared with a superclass/parent type and initialized with a subclass/child type.

A a method is invoked on that object.

When is it determined if the method is allowed to be invoked?

a. when the code is run (executed)

b. when the code is compiled

c. it is different for different programs

d. when the code is written

Question 2:

A variable is declared with a superclass/parent type and initialized with a subclass/child type.

A a method is invoked on that object.

When is it determined which version of the method will be invoked (parent or child)?

a. when the code is compiled

b. when the code is written

c. when the code is run(executed)

d. it is different for different programs

Question 3:

A polymorphic reference can refer to different types of objects at different points in time.

a. true

b. false

Question 4:

If you invoke a method that exists in the class of the actual type, but not the declared type, the code will not compile.

a. true

b. false

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!