Skip to content

Instantly share code, notes, and snippets.

@benweidig
Created May 16, 2020 16:45
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 benweidig/b54db55b91f6495e8f48e44a47694a03 to your computer and use it in GitHub Desktop.
Save benweidig/b54db55b91f6495e8f48e44a47694a03 to your computer and use it in GitHub Desktop.
interface WithException {
void doWork() throws IOException;
}
class WithoutException implements WithException {
// We omit the exception in the implementation
@Override
public void doWork() {
...
}
}
// Won't compile without try-catch
WithException with = new WithoutException();
// Compiler won't complain
WithoutException without = new WithoutException();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment