If RuntimeException is thrown, can it be caught as an Exception?
问题 If I have a try block that throws a RuntimException subclass, can a subsequent catch block catches it as an Exception ? Specifically: public class MyAppException extends RuntimeException { // .... } // In some other part of the code: try { // Executing this results with doSomething() throwing a MyAppException. int x = doSomething(); } catch(Exception exc) { // Does the thrown MyAppException get caught here? } My thinking is yes , because a RuntimeException extends Exception . However I have