File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes [B&S] some questions about Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "[B&S] some questions about "Required Interface"" Watch "[B&S] some questions about "Required Interface"" New topic
Author

[B&S] some questions about "Required Interface"

Jimmy Chen
Ranch Hand

Joined: Apr 11, 2005
Posts: 54
hi, I got some questions about the required interface

first, in the interface sun gives us the read method it says:

// Reads a record from the file. Returns an array where each
// element is a record value.
public String [] read(int recNo) throws RecordNotFoundException;


As I understand, it returns ONE record each time and the string array should carry the field values for this record. like array[0] stores the first field's value. Here "a record value" should be a field value. Is it right?

another question, what's the value of recNo? I can't find it from the database schema. Is it just a index of the record or other id? Is it in the database or just used for the program(record index)?

third question, when I use the "Data.java" to implement the interface, Can I use another class to wrap "Data.java"?


thanks in advance!!!
[ June 26, 2006: Message edited by: Nova Chen ]
Bob Nedwor
hangman
Ranch Hand

Joined: Aug 17, 2005
Posts: 215

As I understand, it returns ONE record each time and the string array should carry the field values for this record. like array[0] stores the first field's value. Here "a record value" should be a field value. Is it right?
Yes, that is the way I interpreted it.

public String [] read(int recNo) throws RecordNotFoundException;
Are you sure? In my project it was:
public String [] readRecord(long recNo) throws RecordNotFoundException; I am not sure why you get to use an "int" and I had to use a "long." No fair. ...But this is basically the unique, "nth" record in the datafile.

when I use the "Data.java" to implement the interface, Can I use another class to wrap "Data.java"?
Yes, as a matter of fact, I would find it difficult to do it any other way..

I hope this helps.


Bob N
SCJP - 1.4
SCJD - (B&S) Used 1.5 And It Runs On Solaris10
SCWCD - Thanks to HFSJ!!
Anna Hays
Ranch Hand

Joined: Nov 09, 2003
Posts: 131
I used the Adaptor pattern instead of wrapping to make it an object oriented data layer package. I think Sun will use the Data.java to mark your assignment so becareful. Better to be safe than sorry.

When you say wrapping I assume you mean subclassing it then you can use the interface like DB db = new SubDataClass();
Jimmy Chen
Ranch Hand

Joined: Apr 11, 2005
Posts: 54
thanks Bob and Anna very much!

Bob, I can't find any long parameters in the interface of my assignment

Anna, I just want to use the adaptor as in Andrew's book (that's what I saying wrap).
Jeroen T Wenting
Ranch Hand

Joined: Apr 21, 2006
Posts: 1847
There are several different versions of the assignment with small differences like different datatypes and method signatures.


42
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: [B&S] some questions about "Required Interface"
 
Similar Threads
[URLyBirdHotel 1.3.3] Couldn't I use Data.java interface class?
URLyBird 1.2.1 - SecurityException
recNo in Bodgitt and Scarper
NX: URLyBird 1.3.2. Question about the process of booking.
NX: About data consistent