[Solved] Throwing exceptions syntax java


You have two issues:

1) Your closing } for the try is inside the if.

2) You are not properly calling the constructor of IllegalArgumentException. Do `throw new IllegalArgumentException();

In the future, you should read and try to understand the compiler message. It is most likely telling you exactly what there errors are and where. (That is why your question has been down-voted so much.)

I get that you’re new to this so I am more than happy to help you out.

Happy coding.

7

solved Throwing exceptions syntax java