Created
May 16, 2020 16:45
-
-
Save benweidig/b54db55b91f6495e8f48e44a47694a03 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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