Figure 1: The base of the Java exception hierarchy.Types in red, and their subclasses, are unchecked .
예외처리(try~catch) 사용 예제
예외 던지기(강제 발생) 사용 예제
사용자예외처리 사용 예제
java.lang
Class Exception
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- All Implemented Interfaces:
- Serializable
- Direct Known Subclasses:
- AclNotFoundException, ActivationException, AlreadyBoundException, ApplicationException, AWTException, BackingStoreException, BadAttributeValueExpException, BadBinaryOpValueExpException, BadLocationException, BadStringOperationException, BrokenBarrierException, CertificateException, CloneNotSupportedException, DataFormatException, DatatypeConfigurationException, DestroyFailedException, ExecutionException, ExpandVetoException, FontFormatException, GeneralSecurityException, GSSException, IllegalClassFormatException, InterruptedException, IntrospectionException, InvalidApplicationException, InvalidMidiDataException, InvalidPreferencesFormatException, InvalidTargetObjectTypeException, IOException, JAXBException, JMException, KeySelectorException, LastOwnerException, LineUnavailableException, MarshalException, MidiUnavailableException, MimeTypeParseException, MimeTypeParseException, NamingException, NoninvertibleTransformException, NotBoundException, NotOwnerException, ParseException, ParserConfigurationException, PrinterException, PrintException, PrivilegedActionException, PropertyVetoException, ReflectiveOperationException, RefreshFailedException, RemarshalException, RuntimeException, SAXException, ScriptException, ServerNotActiveException, SOAPException, SQLException, TimeoutException, TooManyListenersException, TransformerException, TransformException, UnmodifiableClassException, UnsupportedAudioFileException, UnsupportedCallbackException, UnsupportedFlavorException, UnsupportedLookAndFeelException, URIReferenceException, URISyntaxException, UserException, XAException, XMLParseException, XMLSignatureException, XMLStreamException, XPathException
public class Exception extends Throwable
The classException
and its subclasses are a form ofThrowable
that indicates conditions that a reasonable application might want to catch.The class
Exception
and any subclasses that are not also subclasses ofRuntimeException
are checked exceptions. Checked exceptions need to be declared in a method or constructor'sthrows
clause if they can be thrown by the execution of the method or constructor and propagate outside the method or constructor boundary.- Since:
- JDK1.0
- See Also:
Error
, Serialized Form- See The Java™ Language Specification:
- 11.2 Compile-Time Checking of Exceptions
-
-
Constructor Summary
Constructors Modifier Constructor and Description Exception()
Constructs a new exception withnull
as its detail message.Exception(String message)
Constructs a new exception with the specified detail message.Exception(String message, Throwable cause)
Constructs a new exception with the specified detail message and cause.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 stack trace enabled or disabled.Exception(Throwable cause)
Constructs a new exception with the specified cause and a detail message of (cause==null ? null : cause.toString()) (which typically contains the class and detail message of cause).
-
Method Summary
-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
-
'Dev. 자바 > API 및 이론' 카테고리의 다른 글
[JAVA API] java.lang.Enum<E>, 열거형 (0) | 2012.08.08 |
---|---|
[JAVA API] java.util.HashMap<K,V> (0) | 2012.08.07 |
[JAVA API] java.util.Stack<E> (0) | 2012.08.07 |
[JAVA API] java.util.ArrayList<E> (0) | 2012.08.07 |
[JAVA API] java.lang.System (0) | 2012.08.03 |