In Java, there are some kinds of exceptions which require a throws statement:
public void myMethod() throws IOException {
throw new IOException("Error!");
}
while others don't:
public void myOtherMethod() {
throw new IllegalArgumentException("Error!");
}
public void myThirdMethod() {
throw new Error("Error!");
}
The first method wont compile wthout the throws
statement.
What is the criteria for determining if an Exception
/Error
requires a throws
statement?