import java.io.InterruptedIOException;
import java.nio.file.FileSystemException;

class Test {
    public void foo() throws InterruptedIOException {
        try {
        	// compiler knows the exact class of the exception, so we do not have
        	// to define one in the `catch` block explicitly
            throw new InterruptedIOException();
        } catch (Exception ex) {
            // do something with the exception (logging?)
            throw ex;
        }
    }

    public void bar(int i) throws InterruptedIOException {
        try {
            if (i < 0) {
                throw new InterruptedIOException();
            } else {
                throw new FileSystemException("test");
            }
        } catch (Exception ex) {
        	// do something with the exception (logging?)
            throw ex; // compile-time error
        }
    }
}