RE: What is difference between checked and unchecked e...
checked Exceptions must be dealt with in either a try/catch block or by declaring a "throws" in a method. Unchecked exceptions normally are Runtime exceptions like NullPointerException or ClassCastException.
A simple rule of thumb: If it's an exception you can possibly deal with (continue to run the program using some alternative code) use checked exceptions. For exceptions that should never happen (if they do it's a bug) use unchecked (Runtime) exceptions which will come up to the surface and displayed to the user. Like this you assure that if there's a bug it will show up eventually and can be fixed and you don't run the risk of catching an exception and forgetting to deal with it (f.i. empty catch block).
Also if you want more details then go through the following URL....
RE: What is difference between checked and unchecked e...
Unchecked exceptions are those exceptions that are not mentioned after throws clause. Checked exceptions are those which are mentioned in the throws clause
RE: What is difference between checked and unchecked exception ?
checked exception is compile time exception which inherit "Exception" and unchecked exception is Rintime exception which is subclass of "RuntimeException"
RE: What is difference between checked and unchecked exception ?
checked exceptions must be handeled.That is a try-catch must either be nested around the call to the method that throws the exception.The compiler will throw an error message if it detects an uncaught exception and will not compile the file.
The run-time exceptions(unchecked exceptions) do not have to be caught. This avoids requiring that a try-catch be place around for example every integer division operation to catch a divide by zero or around every array variable to watch for indices going out of bounds.
You can use multiple catch clauses to catch the different kinds of exceptions that code can throw as shown in this snippet:
try { ... some code... } catch (ArrayIndexOutOfBoundException e) { ... } catch (IOException e) { ... } catch (Exception e) { ... } finally // optional { ...this code always executed even if no exceptions... }