How is it that answer suggests that the "throws" must be removed from method declaration for the code to compile yet my java compiler (jdk7) does not complain?
The answer does NOT say throws must be removed - instead it suggests that it could be removed, and the code would still compile. In other words, the code should compile despite the throws part was there or not, given that ArithmeticException is a runtime exception.
What is the error your Java compiler is prompting? Which line?
Thank you for pointing out the subtle difference. I must have missed it on the first reading. You are correct - ArithmeticException is indeed a runtimeException and as such should be handled with additional code-checks instead of exception handling.
My compiler is OK with both version - with and without the 'throws' declaration.
In other words, you can never make a visible difference to the outcome by adding or removing an un-checked exception from the throws part of a method.