Hacker News new | ask | show | jobs
by wizzard 5221 days ago
In the Java example there is a ton of error checking that is not being done in the other examples. Not really a fair comparison. The author said the programs should complete the task of "reading two numbers from the user, adding them together and printing out the result." The Java program does more than that, so of course it looks more verbose.
1 comments

I think it is a fair example: both NumberFormatException and IOException are checked exceptions, so the code will fail to compile if they're not caught.
Despite being checked, they do not necessarily have to be caught if you add a `throws` clause in the method declaration.