interface P{}
class A{}
class Demo{
public static void main(String arg[]){
A a1=null;
P p1=null;
a1=(A)p1; //legal
p1=(P)a1; //legal
}
}
In this code, the interface P and the class A a are not in the same hierarchy but statements typed to cast interface to class and class to interface are legal. So why this is legal?