What is the difference between the File and RandomAccessFile classes? (Select three correct answers) A: The File class encapsulates the files and directories of the local file system. B: The File and RandomAccessFile can be chained together in order to manipulate some files. C: The RandomAccessFile class provides the methods needed to directly access data contained in any part of a file. D: The File deals with byte while RandomAccessFile deals with char of the target file. I did not understand how point A (that was a prt of the answer) could be the difference between File and RandomAccessFile classes??? Both of them encapsulates the files and directories of the local file system, nah ???
Both of them encapsulates the files and directories of the local file system, nah ???
RandomAcessFile's constructors will throw FileNotFoundException if the argument passed in is a directory.
Also the phrase is not very accurate. "encapsulates" seems to refer to the fact that an object holds a field of another object, controlling access to it. A better word is "abstracts". I would say: A File object represents an abstraction of a file or directory pathname. And It does so in a machine independent way. Regarding RandomAccessFile abstracts nothing. Its purpose is to access the content of a file not sequentially. However File does not deal with contents at all.
The structure of the question is also somewhat suspect - picking 3 out 4 correct. You get a 25% chance of being correct by random selection. Questions that have 3 correct answer choices will typically have a larger answer selection list ( at least 5, typically 6 or more ). ----------------------------------- Considering the Certified Java Programmer Exam? Get JCertify! The best investment in your career you will make all year http://www.enterprisedeveloper.com/jcertify Exams and integrated content for 310-025 and 310-035
posted 16 years ago
yeh was kinda confused with the wordings ... Thanks a lot folks even the site turned out to be helpful !!!