Exception handling allows programmers to deal with unexpected situations that may occur in their programs. As an example, the FileReader class in the java.io package is used to open a file. Creating an instance of this class will cause Netbeans to give a reminder that the class’s constructor may throw a FileNotFoundException. Attempting to run the program will also cause the compiler to point this out.
import java.io.*;// ... FileReader in = new FileReader("Missing.file"); // error
To get rid of this compile-time error the exception must be caught by using a try-catch statement. This statement consists ...