I have a very simple question about re-throwing exception in Java.
Here is the code snippet:
public static void main(String[] args) throws FileNotFou
You are right. Second version is better. Moreover the first version does not make any sense. It does the same except the stack trace of the exception will be "wrong".
There are the following reasons to "re-throw" exceptions:
example:
try {
// do something
} catch (IOException ioe) {
throw new IllegalStateException(ioe);
}