I've got a method which invokes another method like this:
public void m1() {
m2(10);
}
public void m2(int v) {
if(v < 10)
throw new MyException();
}
public class MyException extends RuntimeException{ }
Now, I'd like to notify clients who are going to use m1()
that it might throw MyException
. Is it OK if I declare it like this:
public void m1() throws MyException{
m2(10);
}
I'm not sure about it as I used to use throws
declaration with checked exceptions. Is it common to do so with unchecked ones?