This is a question from marcus greens's exam # 1. Q17
I thought the answert would be 1, but the answer is 3.
Can some one please explain?
Thanks,
Mugdha.
What will happen if you attempt to compile and run the following code?
1) Compile and run without error
2) Compile time Exception
3) Runtime Exception
class Base {}
class Sub extends Base {}
class Sub2 extends Base {}
public class CEx{
public static void main(
String argv[]){
Base b=new Base();
Sub s=(Sub) b;
}
}