ClassCastException You can cast null into anything without raising a ClassCastException. Generally, this is a good thing. Otherwise every cast would need an if to specially handle the null case. You might be tempted to count on ClassCastExceptions to filter out nulls for you. The following code will not raise a java.lang.ClassCastException: Cat c = null; Object o = c; Dalmatian d = (Dalmatian)o; ------------------------------------------ public class ClassCastException extends java.lang.RuntimeException Students should understand this error/exception when it occurs in a program. An object of this class is thrown when code attempts to cast an object to a subclass of which it is not an instance. For example, the code below generates a ClassCastException. Object o = new Integer(42); String s = (String) o; // generates ClassCastException ------------------------------------------------