hi nitin,
u cud guess right!! i was confused coz of assigning to an Object ref ,now it is clear.as far as ur ques about
In the line given below whether the class A implicitly extends class Object or not.
class B extends A implements Observer{}
it does implicitly extends Object.Correct???
but now see this one which does not involve a third ref to Object type
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;
}
}
why this code is giving runtime classCast Exception???
Acc to me a ref of superclass type can be explicitly casted to ref of subclass type.it is this what is happening.
please explain.
thank you