Why can my code be compiled ? And why can't J_SuperClass be cast to J_SubClass ?
result.jpg
The following is my code:
class J_SuperClass { } class J_SubClass extends J_SuperClass { } public class J_Test { public static void main(String[] args) { J_SuperClass a = new J_SuperClass(); J_SubClass b = new J_SubClass(); b = (J_SubClass)a; } }