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.
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.
mooooooo ..... tiny ad ....
the new thread boost feature: great for the advertiser and smooth for the coderanch user