By convention, unchecked exceptions should not be included in a throws clause. (Including them is considered to be poor programming practice. The compiler treats them as comments, and does no checking on them.)
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
I guess the question could be rephrased as: should the SecurityException thrown by the Data class be a checked exception?
By convention, unchecked exceptions should not be included in a throws clause. (Including them is considered to be poor programming practice. The compiler treats them as comments, and does no checking on them.)
I guess the question could be rephrased as: should the SecurityException thrown by the Data class be a checked exception?
...
But the bad programmer will have their application come crashing down the first time they try and skip steps (such as trying to modify without locking first).
Any unimplemented exceptions in this interface must all be created as member classes of the suncertify.db package
SecurityException IS an implemented exception by Sun.
It is a bad practice to have the same names of classes even if they are in different packages.
But as it's also bad practice to put an unchecked exception in the throws clause of a method, anyway
Any unimplemented exceptions in this interface must all be created as member classes of the suncertify.db package
Thrown by the security manager to indicate a security violation.
You must not require the installation of a security manager.
By convention, unchecked exceptions should not be included in a throws clause. (Including them is considered to be poor programming practice. The compiler treats them as comments, and does no checking on them.)
It is a bad practice to have the same names of classes even if they are in different packages.
I found out such a naming conflict within SUN's APIs, solved thanks to packaging. Unfortunately, I cannot remember which one
Jacques<br />*******<br />MCP, SCJP, SCJD, SCWCD
I.e. RuntimeIOException is not in my thrown clause.
Should I still add it to the java doc comment with an @throw tag? Or should I just specify that it might be thrown in the method description?
Jacques<br />*******<br />MCP, SCJP, SCJD, SCWCD
Phil, why do you say that? The SUN API document for Integer.parseInt(String) method has a throw clause and the parseInt(String) method signature *explicitly* throws a Runtime exception (NumberFormatException).[Phil]: But as it's also bad practice to put an unchecked exception in the throws clause of a method, anyway,
Regards, George
SCJP, SCJD, SCWCD, SCBCD
My honeysuckle is blooming this year! Now to fertilize this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
|