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.
A checked exception is an exception that you'll have to catch or rethrow, otherwise the compiler won't be happy. It's like saying that you're throwing eggs and there's nobody to catch them Checked exceptions extend the Exception class. [ March 21, 2008: Message edited by: Christophe Verre ]
Hi kiran peruka,the checked exception is a exception which you must try-catch or throws it,otherwise java compiler will angry! On the contrary ,you can try -catch unchecked exception ,or not,the complier doesn't complaint you !
A checked exception is any exception that the compiler will check whether you are handling or not. If a code throws a checked exception, you should use a try catch block to catch it or add a throws clause to the method. otherwise the compiler will report an error.
You can indeed determine whether an exception is a checked exception or an unchecked exception at compile-time, by waiting for the compiler to complain about the catch or specify requirement. If you don't have that luxury (e.g. on an SCJP exam), you can also determine this by looking at the exception's type hierarchy. Only subclasses of java.lang.Error and java.lang.RuntimeException are unchecked. Everything else is checked. [ March 21, 2008: Message edited by: Jelle Klap ]
Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.