Organized notes in the head (Java-Exceptions)

My Java environment

try-catch-finally


public class Test {
    public static void main(String... args) {
        System.out.println(getException());
    }

    private static String getException() {
        try {
            throw new Exception();
        } catch (Exception e) {
            return "catch!";
        } finally {
            return "finally!";
        }
    }
}

The execution result is

finally!

Exception class

Throwable
        -> Error
        -> Exception
            -> RuntimeException

Error

ʻExceptionandRuntimeException`

Exception

RuntimeException

Recommended Posts

Organized notes in the head (Java-Exceptions)
Organized memo in the head (Java --Array)
Organized memo in the head (Java --Control syntax)
Organized memo in the head (Java --instance edition)
Organized memo in the head (Java --Data type)
Organized how to interact with the JDK in stages
Jigsaw notes in Gradle
Notes in Android studio
Contributed to Gradle and was named in the release notes
Install the plugin in Eclipse
JavaFX-Load Image in the background
[Resolved in 5.2.1] Spring Security 5.2.0.RELEASE has incompatibilities not mentioned in the release notes
Insert an image in the verification email when authenticating devise email --Notes--