Code: Select all
Mango m = new Mango();
Apple a = (Mango) m;
According to the explanation above shouldn't the code be:The compiler rejects the above code in spite of you guaranteeing that m will point to an Apple
at run time.
Code: Select all
Mango m = new Mango();
Apple a = (Apple) m;