Writing to a File
In the following example, we use the FileWriter class together with its write() method to write some text to the file we created in the previous example.
Note that when you are done writing to the file, you should close it with the close() method:
Some of the file classes are given next (cont.):
Scanner, which is a class in java.util package used for obtaining the input of the primitive types like int, double, etc. and strings
FileInputStream, which is useful to read data from a file in the form of sequence of bytes