ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.


AddThis Social Bookmark Button
  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. You *CAN* ignore checked exceptions in Java
    2004-03-30 07:11:18  typo [View]

  2. You *CAN* ignore checked exceptions in Java
    2003-05-14 11:56:07  anonymous2 [View]

1 to 2 of 2