Hi Javini,
If your assignment instructions state:
// Locks a record so that it can only be updated or deleted by this client.
// If the specified record is already locked, the current thread gives up
// the CPU and consumes no CPU cycles until the record is unlocked.public void lock(int recNo) throws RecordNotFoundException;
And if they also state:
Any methods that throw RecordNotFoundException should do so if a specified record does not exist or is marked as deleted in the database file.
Then assuming that recNo = 12345 doesn't exist in your database file, don't you think that the examiner is going to be surprised if the following call doesn't throw a RecordNotFoundException:
Under what circumstances are you throwing RecordNotFoundException?
Now if my intention in writing the assignment instructions were to get you to throw the RecordNotFoundException when the user tries to lock a record number that doesn't exist, how could I have better communicated that intention than in the assignment instruction quotations above?
If that is the intention of the assignment instructions (and I don't see how another interpretation is possible) then it would be awfully easy for the examiner to determine whether I honored the contract specificed in the interface method comment.
[ March 15, 2004: Message edited by: George Marinkovich ]