title: How to throw FileNotFoundException when using BufferedReader?
body: <pre><code>import java.util.ArrayList;
  import java.io.BufferedReader;
  import java.io.IOException;
  import java.io.FileReader;
  import java.util.ArrayList;
  import java.util.Random;
  
  public class WordList {
      private static Random r = new Random();
  
      private static ArrayList&lt;String&gt; words = new ArrayList&lt;String&gt;();
      String filename = "Cities.txt";
  
      public static void main(String[] args) throws IOException {
          WordList wl = new WordList();
          buffR(wl.filename);
          System.out.println(words);
          System.out.println(getRandomWord());
      }
  
      public static ArrayList buffR(String filename) throws IOException {
          words.clear();
          String line = null;
          BufferedReader br = null;
  
          br = new BufferedReader(new FileReader(filename));
          while ((line = br.readLine()) != null) {
              words.add(line);
          }
          br.close();
          return words;
      }
  
      public static String getRandomWord() {
          WordList wl = new WordList();
          String randomWord;
          if (words.size() &gt; 0) {
              int index = r.nextInt(words.size());
              randomWord = words.get(index);
          } else {
              randomWord = wl.filename + " is missing";
          }
          return randomWord;
      }
  }
  </code></pre>
  
  <p>There is a java.io.FileNotFoundException (regarding my BufferedReader method) when I run this code(I intentionally put a no existing file). However, I already threw IOException in my method header. What should I do to not encounter this error again?</p>