











Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!












InputStream fin = new FileInputStream( filename); int[][] data = new int[ width][ height]; for (int i=0; i < data.length; i++) { for (int j=0; j < data[0].length; j++) { int ch = fin.read(); if (ch == - 1) { fin.close(); throw new IOException("File ended early"); } data[j][i] = ch; } } fin.close();
java.lang.System provides an InputStream and two standard PrintStream objects for doing console I/O.
Note that System.in, for example, is a static member of the class System – this means that the field “in” is associated with the class , not an instance of the class. Recall that static members in Java act like global variables.
A design exercise using java.io and the generic collection libraries (SEE COURSE NOTES)
WordScanner.java Histogram.java