Question: class A is superclass of class B . Method c ( ) is defined in both classes ( overridden ) What happen to the following

class A is superclass of class B. Method c() is defined in both classes (overridden)
What happen to the following code?
A obj = new B();
B.c();
syntax error, type mismatch for obj
class A's version of method c() is executed then class B's version of method c() is executed
class A's version of method c() is executed
class B's version of method c() is executed
class A is superclass of class B . Method c ( )

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 Programming Questions!