interface I{}
class Q1{}
public class Q2{
public static void main(
String arg[]){
Q2 q2 = new Q2();
I i = (I) q2; //compile fine. Why?
test doesn't implement I and compiler known about this
Q1 q1 = (Q1) q2; //this line will fail compile, because Q1 doesn't superclass for Q2 And this is right
}
}
---------------
I i = (I) q2 //Runtime Exception