How to write to file using FileWriter
To writing in a file in Java program we uses a class in java.io package named FileWriter. The main object of the FileWriter class can be created using the following of its constructor i.e. FileWriter(File file), FileWriter(File file, boolean append), FileWriter(FileDescriptor fd), FileWriter(String fileName) and FileWriter(String fileName, boolean append) etc.
This link will helpful for you http://www.roseindia.net/java/examples/io/writeTofileFileWriter.shtml