Skip to content

Instantly share code, notes, and snippets.

@dragonfax
Created June 17, 2013 23:50
Show Gist options
  • Save dragonfax/5801540 to your computer and use it in GitHub Desktop.
Save dragonfax/5801540 to your computer and use it in GitHub Desktop.
Throw a checked exception with no fucks given (no declaring the checked exception).
class NoFucks {
public NoFucks () throws Exception {
throw new Exception();
}
}
...
try {
NoFucks.class.newInstance();
} catch(InstantiationException e) {
} catch(IllegalAccessException e) {
}
// never gets here. Exception is thrown.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment