Skip to content

Instantly share code, notes, and snippets.

@celeroncoder
Created May 20, 2021 15:49
Show Gist options
  • Save celeroncoder/a755f658832d3c85fbbe5bf7b2a0fd35 to your computer and use it in GitHub Desktop.
Save celeroncoder/a755f658832d3c85fbbe5bf7b2a0fd35 to your computer and use it in GitHub Desktop.
Reporting Exceptions in Java
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