Skip to content

Instantly share code, notes, and snippets.

@zgulde
Created April 3, 2018 20:58
Show Gist options
  • Save zgulde/43457cf0d3df92c3a31a30a68384ffdf to your computer and use it in GitHub Desktop.
Save zgulde/43457cf0d3df92c3a31a30a68384ffdf to your computer and use it in GitHub Desktop.
Example of Java Stack Traces
public class StackTraceExample {
private static void a() throws Exception {
b();
}
private static void b() throws Exception {
c();
}
private static void c() throws Exception {
d();
}
private static void d() throws Exception {
throw new Exception("Something Bad Happened!");
}
private static void x() {
y();
}
private static void y() {
z();
}
private static void z() {
try {
a();
} catch (Exception e) {
throw new RuntimeException("Ahhhhhh!!!!", e);
}
}
public static void main(String[] args) {
x();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment