Sorry
Jose Coqueiro but the book is correct and you are wrong.
It looks like you are modifying the code and not following what the exam watch has said exactly, if you look carefully to your main() method it looks like you throws the exception there. So if you remove the Exception in your main() method then the error will be reported by the compiler, that Exception must be caught or thrown again which is what you did exactly therefore
you should not have complained why your code works. If you want to
test something in the future for confirming a solution, you need to make sure to stick with the conditions.
Cheers!!!