Writing to a text file using FileWriter (not PrintWriter) In this example books are added to a growing list of books that is stored in a text file. Therefore we are appending new book records to the bottom on the file thereby creating a flat file database (text based database).

Data from the keyboard is concatenated together. The book record is then stored in a buffer, and finally written to the file. The buffer and the text file is then closed before being reopened to capture a new book record. You will be able to access the newly created file in the projects folder (not your src (source) folder.

Click here for the code