The compiler sees that you are calling CatchException.method() in main() and that you are not handling it in any way (either catching or declaring main() to throw NewException as well. Thus the error.

The compiler doesn't care if you are actually throwing that exception or not. Have a look at ByteArrayInputStream.close() - there is no way it'll ever throw an IOException - but you still have to handle it since it's declared.