// Following import is assumed throughout this section. import java.io.*; try { BufferedReader input = new BufferedReader( new FileReader("/usr/share/dict/words")); String line; while ((line = input.readLine()) != null) if (line.indexOf("blue") != -1) System.out.println(line); input.close(); } catch (IOException ex) { System.err.println("Error occured"); } |
try { File temp = File.createTempFile("prefix", ".suffix"); temp.deleteOnExit(); } catch (IOException ex) { System.err.println("File could not be created"); } // vim: set sw=4 : set tw=85 : |