You cannot cast a "Child" object to its "Parent" like this... Though it will compile ,on runtime java identifies that p1 holds a reference which is not assignment compatiable with c1 and will throw java.lang.ClassCastException: Parent
The p1, referencing to a Parent Object, cannot be cast to Child because a Parent is not a Child. But a Child is a Parent since the Child inherits all the methods in Parent class. However, if p1 is referencing to a Child object or a subclass of Child, then you can cast p1 to Child.
Without the cast to Child you would get a compile time error. The cast tells the compiler that you really mean to do this and the actual type of Parent does not get resolved until runtime. Casting down the object hierarchy is a problem, as the compiler cannot be sure what has been implemented in descendent classes. Casting up is not a problem because sub classes will have the features of the base classes. This can feel counter intuitive if you are aware that with primitives casting is allowed for widening operations (ie byte to int).