Class Exception

java.lang.Object
java.lang.Throwable
java.lang.Exception
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
AbsentInformationException,AgentInitializationException,AgentLoadException,AlreadyBoundException,AttachNotSupportedException,AWTException,BackingStoreException,BadAttributeValueExpException,BadBinaryOpValueExpException,BadLocationException,BadStringOperationException,BrokenBarrierException,CardException,CertificateException,ClassNotLoadedException,CloneNotSupportedException,DataFormatException,DatatypeConfigurationException,DestroyFailedException,ExecutionControl.ExecutionControlException,ExecutionException,ExpandVetoException,FontFormatException,GeneralSecurityException,GSSException,IllegalClassFormatException,IllegalConnectorArgumentsException,IncompatibleThreadStateException,InterruptedException,IntrospectionException,InvalidApplicationException,InvalidMidiDataException,InvalidPreferencesFormatException,InvalidTargetObjectTypeException,InvalidTypeException,InvocationException,IOException,JMException,JShellException,KeySelectorException,LambdaConversionException,LineUnavailableException,MarshalException,MidiUnavailableException,MimeTypeParseException,NamingException,NoninvertibleTransformException,NotBoundException,ParseException,ParserConfigurationException,PrinterException,PrintException,PrivilegedActionException,PropertyVetoException,ReflectiveOperationException,RefreshFailedException,RuntimeException,SAXException,ScriptException,ServerNotActiveException,SQLException,StringConcatException,TimeoutException,TooManyListenersException,TransformerException,TransformException,UnmodifiableClassException,UnsupportedAudioFileException,UnsupportedCallbackException,UnsupportedFlavorException,UnsupportedLookAndFeelException,URIReferenceException,URISyntaxException,VMStartException,XAException,XMLParseException,XMLSignatureException,XMLStreamException,XPathException

public classExceptionextendsThrowable
The classException and its subclasses are a form ofThrowable that indicates conditions that a reasonableapplication might want to catch.

The classException and any subclasses that are not alsosubclasses ofRuntimeException arecheckedexceptions. Checked exceptions need to be declared in amethod or constructor'sthrows clause if they can be thrownby the execution of the method or constructor and propagate outsidethe method or constructor boundary.

SeeJava Language Specification:
11.2 Compile-Time Checking of Exceptions
Since:
1.0
See Also:
  • Constructor Details

    • Exception

      public Exception()
      Constructs a new exception withnull as its detail message.The cause is not initialized, and may subsequently be initialized by acall toThrowable.initCause(Throwable).
    • Exception

      public Exception(String message)
      Constructs a new exception with the specified detail message. Thecause is not initialized, and may subsequently be initialized bya call toThrowable.initCause(Throwable).
      Parameters:
      message - the detail message. The detail message is saved for later retrieval by theThrowable.getMessage() method.
    • Exception

      public Exception(String message,Throwable cause)
      Constructs a new exception with the specified detail message andcause.

      Note that the detail message associated withcause isnot automatically incorporated inthis exception's detail message.

      Parameters:
      message - the detail message (which is saved for later retrieval by theThrowable.getMessage() method).
      cause - the cause (which is saved for later retrieval by theThrowable.getCause() method). (Anull value is permitted, and indicates that the cause is nonexistent or unknown.)
      Since:
      1.4
    • Exception

      public Exception(Throwable cause)
      Constructs a new exception with the specified cause and a detailmessage of(cause==null ? null : cause.toString()) (whichtypically contains the class and detail message ofcause).This constructor is useful for exceptions that are little more thanwrappers for other throwables (for example,PrivilegedActionException).
      Parameters:
      cause - the cause (which is saved for later retrieval by theThrowable.getCause() method). (Anull value is permitted, and indicates that the cause is nonexistent or unknown.)
      Since:
      1.4
    • Exception

      protected Exception(String message,Throwable cause, boolean enableSuppression, boolean writableStackTrace)
      Constructs a new exception with the specified detail message,cause, suppression enabled or disabled, and writable stacktrace enabled or disabled.
      Parameters:
      message - the detail message.
      cause - the cause. (Anull value is permitted,and indicates that the cause is nonexistent or unknown.)
      enableSuppression - whether or not suppression is enabled or disabled
      writableStackTrace - whether or not the stack trace should be writable
      Since:
      1.7