What does “duck an exception” mean?

Well, ducking simply means to lower your head in order to avoid being hit or seen. In this case, ‘duck an exception’ just means avoiding your code from getting hit by an exception.

For your method not to be hit by exception, you throw it further up the call stack by declaring a throws exception on your method

public void myMethod() throws IOException {

}

If you don’t duck, you have to catch it:

public void myMethod() {
    try {
       // ...  

    } catch(IOException e) {
      // handle exception
    }

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)