Stop show with sound  Next slide in show -- Keyboard shortcut: 'n'  3 minutes, 36 secondsLecture 10 - slide 20 : 26
Program 1
import java.io.*;

public class FindLetterInFile {
    public static void main(String[] args) throws IOException {
      boolean result;
      result = lookForLetter(new FileReader(new File(args[0])), args[1]);
      if (result)
        System.out.println("We found the letter: " + args[1]);
      else
        System.out.println("No such letter: " + args[1]);
    }
      
    public static boolean lookForLetter(FileReader in, String letter) throws IOException {
        int c;
        try{
          do{
             c = in.read();
             if (c == letter.charAt(0))
               return(true);
          } while (c != -1);  
        }
        finally{
          in.close();
          System.out.println("Vi lukker filen");
        };  // end try
        return(false); // not found

    }
}