I have thought about exceptions for my assignemnt and would like to know if I am on the right track.
My assignment throws two unchecked exceptions RecordNotFoundException and
DuplicateKeyException and says the following
"Any unimplemented exceptions in this interface must all be created as member classes of the suncertify.db package. Each must have a zero argument constructor and a second constructor that takes a
String that serves as the exception's description.
Any methods that throw RecordNotFoundException should do so if a specified record does not exist or is marked as deleted in the database file."
****************************************************************************
This is what I intend to do ...
FOR GIVEN EXCEPTIONS :
1. Create a RecordNotFoundException extending RunTimeExceptions and handle only Record not found exceptions
2. Create a DuplicateKeyException extending RunTimeExceptions and handle only Record not found exceptions
3.CHECKED exceptions :
Create AllOtherExceptions extending Exception and handle all other exceptions in here .
some thing like
catch(Exception ex) {
throw new AllOtherExceptions ("UNEXPECTED EXCEPTION");
}
4.Other RunTime Exceptions : Do Nothing.
*************************************************
Does this strategy cover all the requsite things ...
Thanks for your time.