{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

FilesExamples - BufferedReader rd = new BufferedReader(new...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
/* * FilesExample.java * ----------------- * This program shows an example of reading a file. */ import acm.program.*; import acm.util.*; import java.io.*; import java.util.*; public class FilesExamples extends ConsoleProgram { public void run() { setFont("Times New Roman-24"); try {
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: BufferedReader rd = new BufferedReader(new FileReader("students.txt")); while (true) { String line = rd.readLine(); if (line == null) break; println("Read line: [" + line + "]"); } rd.close(); } catch (IOException ex) { throw new ErrorException(ex); } } }...
View Full Document

{[ snackBarMessage ]}