Forums Register Login
Checked exceptions
What are checked exceptions?
Could any explain me about this in details and also i would like to know if there are any sites to understand OOPs with java.
thanks in advance
What are checked exceptions?
A checked exception is any exception that is listed in the throws clause of a method and not an ancestor of RuntimeException. For example:

The compiler will complain on the call to test2() because IOException is a checked Exception, so you must wrap the call in a try-catch block:

Also take note of the fact that even though test1() is declared to throw RuntimeException, the compiler doesn't make any effort to enforce that as it does with the IOException. It is really a waste of time to declare a throws RuntimeException because the fact is any method can unexpectedly throw a RuntimeException.
All of the world's problems can be solved in a garden - Geoff Lawton. Tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database

This thread has been viewed 746 times.

All times above are in ranch (not your local) time.
The current ranch time is
Jan 22, 2019 19:54:32.