How do I write data to a file?

This example shows you how to write data to a file.
package net.javaiq.examples.files;

import java.io.BufferedWriter;
import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.IOException;

/**
 * This class demonstrates on how to write data to a file. 
 * @author JavaIQ.net
 * Creation Date Dec 10, 2010
 */
public class DataToFileWriter {
    public static void writeDataToFile(String fileName, String data) {
        try {
            BufferedWriter writer = new BufferedWriter(new FileWriter(fileName, false));
            writer.write(data);
            writer.flush();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    /**
     * Method to test other methods in the class with sample inputs
     * @param args
     */
    public static void main(String[] args) {
        String fileName = "C:\\data.txt";
        String data = "Welcome to the world of Java!!";
        writeDataToFile(fileName, data);
    }
}