Leo Sutic wrote:
As soon as you declare it, the compiler will require a
try/catch or throws clause--even if it is a RuntimeException.
No.
public class Hack {
public void method () {
method2 ();
}
public void method2 () throws IllegalArgumentException {
throw new IllegalArgumentException ("Yadda");
}
public static void main (String[] args) {
Hack h = new Hack ();
h.method();
}
}
Really? I did the exact same thing and got an error during compilation.
It must be a stricter IDE specific compiler. I'm not sure that we can
count on that continuing to be the case forever though.