Given the following class definitions :
interface MyInterface{}; class A {}; class B extends A implements MyInterface{}; class C implements MyInterface{};
and the following object instantiations:
A a = new A (); B b = new B (); C c = new C ();
Which of the following assignments are legal at compile time?
Select 1 option
Correct Option is : C
The statements c = b and b = c are illegal, since neither of the classes C and B is a subclass of the other.
Even though a cast is provided, the statement c = (C) b is illegal because the object referred to by b cannot ever be of type C.