title: Java actionlistener variable is accessed from within inner class
body: <p>I'm trying to read from a file when I click my button, but I get <code>variable is accessed from within inner class</code> when hovering over the word line.</p>
  
  <pre><code>BufferedReader br = new BufferedReader(new FileReader("OGList.txt"));
  String line;
  
  
  SteamIDBtn.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent e) {
          try {
              while((line = br.readLine()) != null){
                  System.out.println(line);
              }
          } catch (IOException e1) {
              e1.printStackTrace();
          }
      }
  }
  </code></pre>