Module java.base
Package java.lang

Class ClassCastException

All Implemented Interfaces:
Serializable

public class ClassCastException extends RuntimeException
This runtime exception is thrown when a program attempts to cast an object to a type with which it is not compatible.
See Also:
  • Constructor Details

    • ClassCastException

      public ClassCastException()
      Constructs a new instance of this class with its walkback filled in.
    • ClassCastException

      public ClassCastException(String detailMessage)
      Constructs a new instance of this class with its walkback and message filled in.
      Parameters:
      detailMessage - String The detail message for the exception.