previous | start | next

The finally Clause

FileReader reader = new FileReader(filename);
try
{
   Scanner in = new Scanner(reader);
   readData(in);
}
finally
{
   reader.close(); // if an exception occurs, finally clause is also
                   // executed before exception is passed to its handler
}

previous | start | next