Skip to content

Instantly share code, notes, and snippets.

@WonderCsabo
Created November 28, 2014 08:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save WonderCsabo/b600f0a487f8b7033ff4 to your computer and use it in GitHub Desktop.
Save WonderCsabo/b600f0a487f8b7033ff4 to your computer and use it in GitHub Desktop.
Java can be tricky, too :)
public class Main {
public static class Hello {
void fun() throws NullPointerException {
}
}
public static class Hello2 extends Hello {
@Override
void fun() throws RuntimeException {
throw new ArithmeticException();
}
}
public static void main(String[] args) {
Hello hello = new Hello2();
try {
hello.fun();
} catch (NullPointerException e) {
e.printStackTrace();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment