go to previous page   go to home page   go to next page        

Answer:

It says that the program no longer needs the file. The system then finishes any operations in progress on the file.

Closing Input Files

Closing an input file is less important than closing an output file. When end-of-file is detected there is no more data. (There is no need to flush an input file). But close input files anyway. Doing so lets the operating system manage resources more effectively.

Of course, to write to a file after reading it in, the file must first be closed and then opened for output (with a FileWriter stream). A word processor program might do this, for example.

Also, a program can open a file so that it can be both read and written during the same session. A file opened this way is said to be open for direct access or random access. This subject is not covered in these notes.

QUESTION 6:

Can a program simultaneously read from one file and write to another?