Let see if I can explain this. A superclass can be assigned to any of its subclasses, and this will compile and run.
ie. SuperClass b = new SubClass();
Because this is possible, it makes sense to have a method to assigned that superclass back to another subclass variable, to go the other way around. Thats what the casting is for.
ie. SubClass a = (SubClass)b;
BUT it is important to note that the object reference 'a' can point to SubClass objects. It can't point to SuperClass objects. Thats what you are doing.
The casting tills
Java, hey I know what I am doing, this type conversion is ok. BUT it is still checked at run time. At runtime java says, WAIT you can't assign a subclass reference to a superClass object. This cast is wrong! Error, or more particularly ClassCastError!
What would work is
SuperClass A = new SubClass();
SubClass B = (SubClass)A;
because A points to a subclass object.
hope that helps!