Both FileWriter and FileOutputStream have a constructor taking a boolean append
as argument. Use this constructor with append
set to true.
Reading the javadoc helps finding the solution for simple problems like that. Java also has a tutorial for almost everything. Google for someSubject Java tutorial, and you’ll find them.