Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

I.O read and write same time?????

 
Michael Lin
Ranch Hand
Posts: 31
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
//this is the mock from : http://www.geocities.com/SiliconValley/Orchard/9362/java/javacert/newboone40-70.html
//I think the answer is c: a file can only be opened for either reading or writing, not both, but the answer is a.
//and I also think only the RandomAccessFile can be done both same time,
//am I right?? thanks!
Question 38: What does the following code do?
File f = new File("hello.test");
FileOutputStream out = new FileOutputStream(f);
Select the one right answer.
Create a new file named "hello.test" if it does not yet exist. It also opens the file so
you can write to it and read from it.
a.Create a new file named "hello.test" if it does not yet exist. The file is not opened.
b.Open a file named "hello.test" so that you can write to it and read from it, but
does not create the file if it does not yet exist.
c.Open a file named "hello.test" so that you can write to it but cannot read from it.
d.Create an object that you can now use to create and open the file named
"hello.test," and write to and read from the file.
 
Baswa Shaker
Greenhorn
Posts: 17
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
c
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic