Слайд 2Consider the following points
Understanding Exceptions
Hierarchy of Exceptions
Types of Exceptions
Handling Exceptions
Throwing Exceptions

Слайд 3Understanding Exceptions
A program can fail for just about any reason:
The code tries

to connect to a website, but the Internet connection is down.
You made a coding mistake and tried to access an invalid index in array.
An Exception is Java’s way of saying, “I give up, I don’t know what to do right now. You deal with it”.
Слайд 6Runtime Exceptions
ArithmeticException – thrown by the JVM when code attempts to divide

by zero.
ArrayIndexOutOfBoundsException – thrown by the JVM when code uses an illegal index to access an array.
ClassCastException – thrown by the JVM when an attempt is made to cast an exception to a subclass of which it is not an instance.
IllegalArgumentException – thrown by the programmer to indicate that a method has been passed an illegal or inappropriate argument.
NullPointerException – thrown by the JVM when there is a null reference where an object is required.
NumberFromatException – thrown by the programmer when an attempt is made to convert a string to a numeric type but the string doesn’t have an appropriate format.
Слайд 7Checked Exceptions
FileNotFoundException – thrown programmitacally when code tries to reference a file

that does not exist.
IOException – thrown programmatically when there is a problem reading or writing a file.
Слайд 8Errors
ExceptionInInitializerError – thrown by the JVM when a static initializer throws an

exception and doesn’t handle it.
StackOverflowError – thrown by the JVM when a method calls itself too many times.
NoClassDefFoundError – thrown by the JVM when a class that the code uses is available at compile time but not runtime.
Слайд 10Throwing Exceptions
A method that generates an unhandled exception is said to throw an exception:
It

generates an exception to signal an exceptional condition
A method it calls throws an exception