Handling RuntimeExceptions in Java

RKCY picture RKCY · Jan 8, 2010 · Viewed 61.7k times · Source

Can anyone explain how to handle the Runtime Exceptions in Java?

Answer

Bozho picture Bozho · Jan 8, 2010

It doesn't differ from handling a regular exception:

try {
   someMethodThatThrowsRuntimeException();
} catch (RuntimeException ex) {
   // do something with the runtime exception
}