Java Tutorial - Java Script :
Several exceptions in the java.io package might occur when you are working with files and streams. A FileNotFound exception occurs when you try to create a stream or file object using a file that couldn’t be located. An EOFException indicates that the end of a file has been reached unexpectedly as data was being read from the file through an input stream. These exceptions are subclasses of IOException. One way to deal with all of them is to enclose all input and output statements in a try-catch block that catches IOException objects. Call the exception’s toString() or getMessage() methods in the catch block to find out more about the problem.