<<< Handling problems within a program | Index | try/catch/finally rules >>> |
When an exception occurs, an object of a particular exception class is created
Java provides a number of exception classes to handle common exceptions such as division by zero, invalid input format, file open/read/write/close errors.
For example,
When a division by zero exception occurs, the program creates an object of the class ArithmeticException
When a Scanner object attempts data input into a program, an invalid format errors are handled using the class InputMismatchException
The class Exception is (directly or indirectly) the superclass of all the exception classes in Java
<<< Handling problems within a program | Index | try/catch/finally rules >>> |