ClassCastException is thrown when your java code cannot find the specified class.
That is incorrect. In such a case a ClassNotFound exception will be thrown.
A ClassCastException occurs when a cast is performed upon an object to a type which is not in the class hierarchy of an object, or to an unimplemented interface. For example, if an object is of class
String, you can cast it to a String, or to an Object (since String extends Object), or to a Comparable (since String implements that interface). But you cannot cast it to a Double or to any other class that it is not one of, not an extension of, or to an interface that it does not implement.
[ June 03, 2004: Message edited by: Bear Bibeault ]