PrepZone Logo
PrepZone
Back to Java

Java · Medium

Can we catch Error in Java? Should we? When might catching OutOfMemoryError be justified?

JavaCore JavaException Handling

Answer preview

Yes, you can catch Error in Java — it extends Throwable and is not checked. But you should almost never do so.…