This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Checked exceptions are also thrown at runtime, of course. If an exception is checked that just means that any piece of the code that might throw a checked exception has either a throws in the methods signature or a try/catch around it. Take FileReader for example, the compiler does not check if the file exists(which would be pointless and impossible to check anyway), but makes sure that there is code in place to handle that possibility.
Given that, it is a mystery to me why NumberFormatException isn't checked. Anything that accepts input from an outside source(network, keyboard, file, ect) should be forced to check for error conditions, IMO. and methods that throw NumberFormatException might not directly take input from outside the program, but that is pretty much the only time they are called. [ October 12, 2006: Message edited by: Robert Hill ]
All subclasses of Exception, other than RuntimeException, are checked Exceptions. You indeed have to catch them in a try-catch-finally block, or if you don't want to catch them, you have to put it in the throws clause of the corresponding method. [ October 12, 2006: Message edited by: Bauke Scholtz ]