3 ms·
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 sh
by wizzard 15y 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.
- hythloday 15y agoI 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.
- anonova 15y agoDespite being checked, they do not necessarily have to be caught if you add a `throws` clause in the method declaration.