Package java.lang
Class ClassCastException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
java.lang.ClassCastException
- All Implemented Interfaces:
Serializable
public class ClassCastException extends RuntimeException
Thrown when a program attempts to cast a an object to a type with which it is
not compatible.
- See Also:
- Serialized Form
-
Constructor Summary
Constructors Constructor Description ClassCastException()Constructs a newClassCastExceptionthat includes the current stack trace.ClassCastException(String detailMessage)Constructs a newClassCastExceptionwith the current stack trace and the specified detail message. -
Method Summary
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
ClassCastException
public ClassCastException()Constructs a newClassCastExceptionthat includes the current stack trace. -
ClassCastException
Constructs a newClassCastExceptionwith the current stack trace and the specified detail message.- Parameters:
detailMessage- the detail message for this exception.
-