• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Runtime exception when to handle them

 
Ram Shree
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Runtime exceptions are exceptions which are NOT enforced by compiler to handle them in compile time.

Since it will difficult for the programmer to anticipate in advance and handle them correctly in the code.
So how does this really help the programmer ? i mean very purpose of handling an exception is not served ? Please clarify.
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We're not generally expected to handle RuntimeExceptions in our code because they are usually caused by programming bugs, and therefore it is usually meaningless or even impossible to handle it. It's a completely different family of exceptions.

We can still catch them, and we typically do at major architectural boundaries. For instance, an app server would catch any RuntimeExceptions that any of its installed apps would throw, so that one app misbehaving won't bring down others.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic