Package java.lang Previous
Previous
Java API
Java API
Index
Index
Next
Next

Class ClassCastException

Constructors

public  class  java.lang.ClassCastException
    extends  java.lang.RuntimeException  
{
        // Constructors
    public ClassCastException();	
    public ClassCastException(String  s);	
}

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:

Object x = new Integer(0); System.out.println((String)x);


Constructors


ClassCastException

public ClassCastException() 

Constructs a ClassCastException with no detail message.


ClassCastException

public ClassCastException(String  s) 

Constructs a ClassCastException with the specified detail message.

ParameterDescription
s the detail message



© 1996 Sun Microsystems, Inc. All rights reserved.