Exceptions in Java
try { doSomething(); } catch (IOException e) { // deal with IOException } catch (OutOfMemoryError oom) { // deal with OutOfMemoryError exception } finally { // do some cleanup that should always run }
try { doSomething(); } catch (IOException e) { // deal with IOException } catch (OutOfMemoryError oom) { // deal with OutOfMemoryError exception } finally { // do some cleanup that should always run }