BufferedWriter writer = new BufferedWriter(new FileWriter(destinyFile)); String content = ""; while (!content.equals("exit")) { content = reader.readLine();//read input from the console writer.write(content + "\n");//write the input to the destinyFile } writer.close(); System.out.println(destinyFile.toString()); //this only gives the fileName and I want to display the content of the file. I'm confused about the inner workings of the writer.write(content) bit. I thought that with this piece of code you write every String to the destinyFile. And how to display the contents of this file?