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?
It's better to close the writer/outputstream in a finally block, just in case something happen
finally{ if(writer != null){ try{ writer.flush(); writer.close(); } catch(IOException ioe){ ioe.printStackTrace(); } } }