import java.io.*; public class WriteFileSol { public WriteFileSol() { write(); } public void write() { //Try to open the stream for writing... try { FileWriter fw; fw = new FileWriter("travis.txt"); //fw.write('x'); //fw.write('\n'); //fw.write('a'); char[]temp = new char[15]; temp = "Hello Travis".toCharArray(); fw.write(temp); fw.close(); } catch (Exception e) { System.out.println("Can't open file"); } } public static void main(String[] args) { WriteFileSol wfs = new WriteFileSol(); } }