- A data file can be text or binary data.
- We will deal with text files (for now).
- A data file can be opened for read, write, append (write to the end of the file), or both read and write.
- A datafile is an example of a stream, which is an object that represents the flow of data into (input stream) or out (output stream) from your program.
- System.in is an input stream and represents the flow of data from the keyboard into your program.
- System.out is an output stream and represents the flow of data from your program to the terminal screen.
- Make sure to open the file before using it and close the file as soon as the code is finished with it.
Here are the notes from our in-class discussion: