Downcasting/Upcasting error at compile time & runtime?
问题 Please check the below program. I have doubt when compiler will issue casting exception at compiler level and when it will be at runtime ? Like in below program, expression I assumed (Redwood) new Tree() should have failed at compiler time as Tree is not Redwood. But it is not failing in compile time , as expected it failed during runtime !!! public class Redwood extends Tree { public static void main(String[] args) { new Redwood().go(); } void go() { go2(new Tree(), new Redwood()); go2(