Kamil Hlubek wrote:Here is written "e.printStackTrace);", but it should be "e.printStackTrace();". It is a little error, but I think it is better to mention it. ( I hope it is okay, that I quoted a little part of the explanation )
Yes, you are correct. The invocation of the
printStackTrace() method has a very minor slip-up as it seems to be only in the explanation. Although Paul Anilprem regularly visits CodeRanch and will probably take note of this minor issue. But because it's such minor issue, it would probably have been better to use
the appropriate Enthuware forum to report the issue.
enthuware.ocajp.i.v8.2.834 wrote:// since you are catching the exception thrown by yourMethod,
// there is no need to declare it in the throws clause of myMethod.
enthuware.ocajp.i.v8.2.834 wrote:// since you are catching the exception thrown by myMethod,
// there is no need to declare it in the throws clause of main.
I don't know what this question is about. And these comments are absolutely spot-on. Just like to add: although there's no need to declare the exception in the throws clause of the method (because you handled the exception), it's completely valid to add the exception to the throws clause of the method. You are required to handle-or-declare a checked exception, but it's perfectly legal (valid) to handle-and-declare a checked exception as well.
Just my 2 cents.
Hope it helps!
Kind regards,
Roel