Class java.lang.ClassCastException
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class java.lang.ClassCastException

Object
   |
   +----Throwable
           |
           +----Exception
                   |
                   +----RuntimeException
                           |
                           +----java.lang.ClassCastException

public class ClassCastException
extends RuntimeException
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);
 

Version:
1.13, 07/01/98
Author:
unascribed
Since:
JDK1.0

Constructor Index

 o java.lang.ClassCastException()
Constructs a ClassCastException with no detail message.
 o java.lang.ClassCastException(String)
Constructs a ClassCastException with the specified detail message.

Constructors

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

Since:
JDK1.0
 o ClassCastException
public ClassCastException(String s)
Constructs a ClassCastException with the specified detail message.

Parameters:
s - the detail message.
Since:
JDK1.0

All Packages  Class Hierarchy  This Package  Previous  Next  Index