Google Guava is a java library with lot of utilities and reusable components.
This requires the library guava-10.0.jar to be in classpath.
The following example shows using Files.write() API.
/**
* @param args
* @throws IOException
*/ public static void main(String[] args) throws IOException {
File file = new File("C:\\abcd.txt");
//Creates a new file if it doesn't exist
//Overwrites the file if already available
Files.write("BE THE CODER", file, Charsets.UTF_8);
System.out.println("Successfully written the file");
}