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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started