A super class reference can hold any of the sub-class objects without any type casts, When you do so you can access only the methods that are defined in the super class, Any attempt to access the sub-class method will result in compilation errot, However if you overrided a method in sub-class and when you call the method (Essentially both have the same name) It will run and finally the method in the child class is called.{Late binding}.
However when you want to assign a super-class reference to a child class you will have to explicitly type caste it to your child class, Or else the compiler will complain.
Now,
P p = new C1();
C2 c = (C2)p;
If the super class refernce is refencing to some other child class (C1) then you will get a class caste exception, But the complier wont complain.
You can avoid this class caste exception if you use isntanceof
if(p instanceof c)
C2 c = (C2)p;
So now this condition will fail and you wont get any exception,
Bye
deepu