Question from the Java and Craftsmanship test

Explain why the second code compiles but the first one doesn't.

Hard

Given these two codes

1.

private void stuff() {
  throw new MyException();
}

private static class MyException extends Exception { }

2.

private void stuff() {
  throw new MyException();
}

private static class MyException extends RuntimeException { }
Author: Clément DevosStatus: PublishedQuestion passed 224 times
Edit
0
Community EvaluationsNo one has reviewed this question yet, be the first!