Playing with new features in Java 7..

related to Exceptions!

Handling More Than One Type of Exception

A single catch block can handle more than one type of exception. If a catch block handles more than one exception type, then the catch parameter is implicitly final.
import static java.lang.System.out;
 
import java.io.IOException;
import java.sql.SQLException;
 
public class MultipleExceptions {
 
    public static void main(String[] args) {
        final int passedArgument = Integer.parseInt(args[0]);
        foo(passedArgument);        
    }
 
    static void foo(final int methodParam) {
        try {
            if (methodParam == 0) {
                throw new IOException();
            } else {
                throw new SQLException();
            }
        } catch (IOException | SQLException ex) {
            out.println(ex);
        }
    }
}

Re-throwing Exceptions with More Inclusive Type Checking

You can specify specific exception types in the throws clause of a method declaration.
import static java.lang.System.out;
 
import java.io.IOException;
import java.sql.SQLException;
 
public class RethrowingExceptions {
    public static void main(String[] args) {
        final int passedArgument = Integer.parseInt(args[0]);
        try {
            foo(passedArgument);
        } catch (SQLException ex) {
            out.println(ex);
        } catch (IOException ex) {
            out.println(ex);
        }        
    }
 
    static void foo(final int methodParam) throws IOException, SQLException {
        try {
            if (methodParam == 0) {
                throw new IOException();
            } else {
                throw new SQLException();
            }
        } catch (Exception ex) {
            throw ex;
        }
    }
}

This analysis is disabled if the catch parameter is assigned to another value in the catch block. If the catch parameter is assigned to another value, you must specify the exception type of the broader exception, in the throws clause of the method declaration.
import static java.lang.System.out;
 
import java.io.IOException;
import java.sql.SQLException;
 
public class RethrowingExceptions {
    public static void main(String[] args) {
        final int passedArgument = Integer.parseInt(args[0]);
        try {
            foo(passedArgument);
        } catch (SQLException ex) {
            out.println(ex);
        } catch (IOException ex) {
            out.println(ex);
        }        
    }
 
    static void foo(final int methodParam) throws IOException, SQLException {
        try {
            if (methodParam == 0) {
                throw new IOException();
            } else {
                throw new SQLException();
            }
        } catch (Exception ex) {
            ex = new Exception();
            throw ex;
        }
    }
}