This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes key field in find method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "key field in find method" Watch "key field in find method" New topic
Author

key field in find method

michael opto
Greenhorn

Joined: Jan 17, 2002
Posts: 29
The following is the comment of the find method from my Data class. From the body of the method, I can tell it is using the first element of the String array expression of a record, which is the flight number. I am confused about: "For this assignment, the key field is the record number field.". What is this record number field?
Thanks in advance!
/**
* This method searches the database for an entry which has a first
* field which exactly matches the string supplied. If the required
* record cannot be found, this method returns null. For this
* assignment, the key field is the record number field.
*
* @param toMatch The key field value to match upon for
* a successful find.
* @return DataInfo The matching record.
* @exception DatabaseException Thrown when database file could not be accessed.
*/
public synchronized DataInfo find(String toMatch) throws DatabaseException {
...
}
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17258
    
    6

The find method compares the argument String to the flight number field. This is the character based field in the db.db. Do not confuse this field with the actual record number, which you pass to the locking mechanism.
Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
michael opto
Greenhorn

Joined: Jan 17, 2002
Posts: 29
Thanks!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: key field in find method