Packages  This Package  Prev  Next  Index  

§1.27 Class ClassCastException

public  class  java.lang.ClassCastException
    extends  java.lang.RuntimeException  (I-§1.42)
{
        // Constructors
    public ClassCastException();	§1.27.1
    public ClassCastException(String  s);	§1.27.2
}
Thrown to indicate that the code has attempted to cast an object to a subclass of which it is not an instance. For example, the following code generates a ClassCastException:


Constructors

ClassCastException

public ClassCastException()
Constructs a ClassCastException with no detail message.

ClassCastException

public ClassCastException(String s)
Constructs a ClassCastException with the specified detail message.
Parameters:
s - the detail message

Packages  This Package  Prev  Next  Index
Java API Document (HTML generated by dkramer on April 22, 1996)
Copyright © 1996 Sun Microsystems, Inc. All rights reserved
Please send any comments or corrections to doug.kramer@sun.com