Errors and exceptions are objects that …
represent unusual or invalid processing.
Error represents an …
unrecoverable situation and should not be caught.
Three ways to deal with exceptions.
call stack trace
The messages printed when an exception is thrown provides a method call stack trace.
try-catch statement
A try-catch statement identifies a block of statements that may thrown an exception.
If an exception is not caught and handled it?
it is propagated to the calling method.
A new exception is defined by deriving a…
new class from the Exception class or one of its decedents.
Checked exceptions must either …
be caught by a method or must be listed in the throws clause of any method that may throw or propagate it.
throws
throws clause is appended to the header of a method definition to formally acknowledge that the method will throw or propagate a particular exception if it occurs.
Unchecked exception requires …
throws clause
The only unchecked exceptions in Java are
objects of type RuntimeException or any of its decendents.
A stream is…
a sequential sequence of bytes; it can be used as a source of input or a destination for output.
Three public reference variables in the System class represent the standard I/O streams.