Hi, the code below doesn't give any compilation / run time errors
-----------------------------------------------------------------
class A{}
class B extends A implements E{}//line 1
class C extends A{}
class D extends B{}
interface E{}
public class Question07 {
public static void main(
String[] args) {
A a = new D();//line 2
C c = new C();//line 3
E e = (E)a;//line 4
B b = (B)e;//line 5
}
}
--------------------------------------------------------------------
question :
1) How to identify that "line 4" and " line 5" is valid is it is based upon the object created / the reference it is pointing to ???
2) I need to know how the instanceof operator works for the above code for each and every condition.
Pls. let me know about these two in detail...
Thanks in advance