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
The class
Exception 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 Summary
ConstructorsModifierConstructorDescriptionConstructs a new exception withnullas its detail message.Constructs a new exception with the specified detail message.Constructs a new exception with the specified detail message andcause.protectedConstructs a new exception with the specified detail message,cause, suppression enabled or disabled, and writable stacktrace enabled or disabled.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).Method Summary
Constructor Details
Exception
public Exception()Constructs a new exception withnullas its detail message.The cause is not initialized, and may subsequently be initialized by acall toThrowable.initCause(Throwable).Exception
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
Constructs a new exception with the specified detail message andcause.Note that the detail message associated with
causeisnot 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). (Anullvalue is permitted, and indicates that the cause is nonexistent or unknown.)- Since:
- 1.4
Exception
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). (Anullvalue 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. (Anullvalue is permitted,and indicates that the cause is nonexistent or unknown.)enableSuppression- whether or not suppression is enabled or disabledwritableStackTrace- whether or not the stack trace should be writable- Since:
- 1.7