Created
May 20, 2021 15:49
-
-
Save celeroncoder/a755f658832d3c85fbbe5bf7b2a0fd35 to your computer and use it in GitHub Desktop.
Reporting Exceptions in Java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Main { | |
public static void main(String[] args) throws Exception { // if the method used within the function is expected to throw an exception the function must also said to be throw exception. | |
start(); | |
} | |
public static void start() throws Exception { | |
try { | |
throw new Exception("This is a exception") | |
} catch (Exception e) { System.out.println(e) } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment