Yes you can do it. Typically, the easiest is to write out the updated contents to a new file. There may be other methods in Java which I have not explored but am familiar with in theory. I recommend you focus on getting your first part of the task to work. Then write a totally different program to practice how to update a text file. Then you can later integrate the two.

Regards,
Jim