Originally posted by Prasanta Chinara:
But should not the compiler see that theres no such class hierarchy exists that can make it possible?
No, the compiler cannot and should not make any assumptions about the existence of a class hierarchy. There are many classes that are not part of the standard
Java libraries, including the classes you make yourself. If the compiler assumed that the only classes in existence were the ones in the standard library, then you and I would not be able to compile or use any new classes.