I want to ask which catch block will be called first, in case of statement something like
try {
...some statement...
} catch (Exception ex) {
System.out.println("out of memory exception");
} catch (OutOfMemoryError error) {
System.out.println("out of memory error");
}
here statement causes OutOfMemoryError
.
I have checked Order of catching exceptions in Java
This is something different, You can't predict that there would be a RunTimeException
occurs if code runs seamlessly.