AnErroris a subclass ofThrowablethat indicates serious problems that a reasonable applicationshould not try to catch. Most such errors are abnormal conditions.TheThreadDeatherror, though a "normal" condition,is also a subclass ofErrorbecause most applicationsshould not try to catch it.
A method is not required to declare in itsthrowsclause any subclasses ofErrorthat might be thrownduring the execution of the method but not caught, since theseerrors are abnormal conditions that should never occur.That is,Errorand its subclasses are regarded as uncheckedexceptions for the purposes of compile-time checking of exceptions.
Constructs a new error with the specified cause and a detailmessage of(cause==null ? null : cause.toString())(whichtypically contains the class and detail message ofcause).
Constructs a new error withnullas its detail message.The cause is not initialized, and may subsequently be initialized by acall toThrowable.initCause(java.lang.Throwable).
Constructs a new error with the specified detail message. Thecause is not initialized, and may subsequently be initialized bya call toThrowable.initCause(java.lang.Throwable).
Parameters:
message- the detail message. The detail message is saved forlater retrieval by theThrowable.getMessage()method.
Constructs a new error with the specified detail message andcause.
Note that the detail message associated withcauseisnotautomatically incorporated inthis error's detail message.
Parameters:
message- the detail message (which is saved for later retrievalby theThrowable.getMessage()method).
cause- the cause (which is saved for later retrieval by theThrowable.getCause()method). (Anullvalue ispermitted, and indicates that the cause is nonexistent orunknown.)
Constructs a new error 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 errors that are little more thanwrappers for other throwables.
Parameters:
cause- the cause (which is saved for later retrieval by theThrowable.getCause()method). (Anullvalue ispermitted, and indicates that the cause is nonexistent orunknown.)