Hello Can some one explain me why this code is compiling without errors ?
Thanks for your help .
import java.io.Serializable;
class B extends A{}
class C extends B{}
public class A {
public static void main(
String[] args) {
A a = new B();
B b =new B() ;
C c = new C() ;
Runnable r1 = (Runnable)a ;
Serializable r2 = (Serializable)a ;
Serializable s2 = (Serializable)c ;
}
}