In Java, I have text from a text field in a String variable called \"text\".
How can I save the contents of the \"text\" variable to a file?
In Java 7 you can do this:
String content = "Hello File!"; String path = "C:/a.txt"; Files.write( Paths.get(path), content.getBytes());
There is more info here: http://www.drdobbs.com/jvm/java-se-7-new-file-io/231600403