Package java.lang |
![]() Previous |
![]() Java API |
![]() Index |
![]() Next |
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);
public ClassCastException()Constructs a ClassCastException with no detail message.
public ClassCastException(String s)Constructs a ClassCastException with the specified detail message.
Parameter Description s the detail message
© 1996 Sun Microsystems, Inc. All rights reserved.