If I remember correctly, it will be correct for compile time. The compiler may allow the cast. But at run time the execution of the program may depend upon what class that object is referring to. Hope my english is correct to convey what I intended to.. any comments...Welcome tvs sundaram
Hi Chao, That's right. You can assign a subclass (Son) object to a superclass (Parent) type as it is guaranteed to have all the same behaviour. You cannot assign a superclass to a subclass because the compiler knows the superclass does not have all the same behaviours and attributes as the subclass (remember, subclasses are specializations of superclasses, they are the same with something extra). You can cast a superclass (Parent) object to a sublcass type (Son) and the code will compile (the compiler assumes you know what you are doing) but at runtime, if the cast object does not have all the behaviours/states of the declared type, you get an error. Hope that helps ------------------ Jane Griscti Sun Certified Programmer for the Java� 2 Platform