Forums Register Login

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

+Pie Number of slices to send: Send
//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.
+Pie Number of slices to send: Send
c
To avoid criticism do nothing, say nothing, be nothing. -Elbert Hubbard. Please critique this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 808 times.
Similar Threads
Files
Files
Some confusing ones part2
Boones' Exam Question Doubt
i/o streams
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 12:36:25.