What I Hate About Your Programming Language
Subject:   You *CAN* ignore checked exceptions in Java
Date:   2003-05-14 06:58:07
From:   anonymous2
Don't program much in Java, do you? To "ignore" an exception thrown at you, just declare your method thusly:

public void myMethod () throws Exception {

With whatever return type, access control, name, and parameter list you need. Saying "throws Exception" ignores the entire group of checked exceptions. You can percolate this all the way up to the main method, which if it throws an exception, causes the default handler (dump the stack to stderr and terminate the thread) to spring into action.

1 to 2 of 2
1 to 2 of 2