For the exam you need to know
FileReader
BufferedReader
FileWriter
BufferedWriter
PrintWriter
Readers and Writers are used to write characters. Writing bytes is done by streams which is not in exam.
Without Using Readers and Writer you can create a file like this
Using FileWriter and FileReader
To Read an object, create a character array to store the input read by the file..as below.
Notice, while writing data we manually used line separators in fw.write("hello\nworld");
Even while reading, we put it into character array, where we need to declare the size intially.
So..usually reader and writer are wrapped and then used. Its a less painful way of writing and reading data to and from file.
Instead of using a BufferedWriter we can use a PrintWriter instead.it has println() method..that is more easier to write.
You just need to repalce the BufferedWriter code above with
To read using BufferedReader
Classes being used to help each other in this manner can be seen in IO extensively, also known as Decorator
Pattern.