203k views
4 votes
If classes C1 and C2 both implement an interface Cint, which has a method whichIsIt, and if C1 c = new C1( ); is performed at one point of the program, then a later instruction c.whichIsIt( ); will invoke the whichIsIt method defined in C1.

a. True.
b, False.

User Spandana
by
8.7k points

1 Answer

5 votes

Answer:

FALSE

Step-by-step explanation:

Because C1 and C2 implement the same interface, they both implement whichIsIt. The variable c is known as a polymorphic variable, meaning that it can change from being an C1 to a C2. So, the message c.whichIsIt( ); may invoke C1's whichIsIt or C2's whichIsIt. This can only be known at runtime.

User MrP
by
8.0k points
Welcome to QAmmunity.org, where you can ask questions and receive answers from other members of our community.