• Post Reply Bookmark Topic Watch Topic
  • New Topic

exceptions in java  RSS feed

 
Gajendra Kangokar
Ranch Hand
Posts: 94
1
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,
i have a small doubt why compiler does not check whether an unchecked exception is handled inside a try-catch() block.
why java has categorized RuntimeException and other non-RuntimeException under unchecked and checked exception.
can anyone give me a clear-cut reason.

Thanks
 
Tim Cooke
Marshal
Posts: 4048
239
Clojure IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There's a bit of a discussion about this on the Oracle tutorial site:
http://docs.oracle.com/javase/tutorial/essential/exceptions/runtime.html

The final word of that being:
If a client can reasonably be expected to recover from an exception, make it a checked exception. If a client cannot do anything to recover from the exception, make it an unchecked exception.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!