Campbell Ritchie wrote:Which class has the setRadius method which actually declares that Exception?
I know you are only doing this as a “what happens if” exercise, which permits you to try anything short of deleting every file on your hard drive, but in real life you would do at least three things differently:-
1: Not give the radius to the exception as a field.2: Not make that exception checked.3: Use java.lang.IllegalArgumentException instead.
sorry about that, I fixed the code, but instead I get a red underline inside my constructor in CircleWithException class.
Yes, if I just use IllegalArgumentException, it works fine.
But the book wants me to create a custom exception to handle this.