Lookin the code:
public class
Test {
public static void main(
String s[]) {
Child c =new Child();
Parent p = new Parent();
c=(Child)p;
}
}
class Parent {
public static void doStuff() {
}
}
class Child extends Parent {
public static void doStuff() {
}
} //why will occur the ClassCastException in runtime?I just know the super class can cast sub class,it's right?why can't do that in this case?