Unformatted text preview: the new data are written into it • If file doesn't exist, an empty file is created PrintWriter out = new PrintWriter("output.txt"); Writing Text Files • Use print and println to write into a PrintWriter : • You must close a file when you are done processing it: • Otherwise, not all of the output may be written to the disk file out.println(29.95); out.println(new Rectangle(5, 10, 15, 25)); out.println("Hello, World!"); out.close();...
View Full Document
- Spring '07
- Writing, Dyslexia, FileReader