at compile time, the compiler simply checks for existance of refernces. even though ur casting is wrong, at runtime, it is quite possible that the references may point to right type of obects on which the casting operation can go thru. due to the fact that till runtime, jvm cannot determine if the references are pointing to objects that can be cast correctly, the compiler performs a simple check if the references/objects exist.
Hi Pawan, Mnasoor is quite right. At the compile time the object creation just needs the relationship among the classes. Thats is either one is subclass of the other. But at the compile time it seeks that u r doing the right casting or not. Like u r doing the casting of the super to sub or what else.