I implemented this code:
class A {
//some code
}
class B extends A {
// some code
}
class C {
public static void main(String []args)
{
Has to do with when casting is done. You are telling the compiler: "Hey, don't worry about it, this is what I say it is, if you have a problem, take it up with me at runtime."
Basically, the compiler is letting you do your thing. When you explicitly cast something, the compiler doesn't do checks. When you run, and the program tries to cast but fails, that's when you will see the error.