title: how to fix local variable referenced from an inner class must be final or effectively final error
body: <p>can you explain me what does the  "local variable referenced from an inner class must be final or effectively final" error means, and why i'm getting it even after declaring my variables involved as final.</p>
  
  <p>here is my code:</p>
  
  <pre><code>public class FenetreJeu extends JFrame {
  
      final Echiquier e = new Echiquier();
      FenetreJeu fj;
      final public JLabel[][] labels = new JLabel[8][8];
  
      Color couleur = new Color(51, 102, 0);
      final Border border = BorderFactory.createLineBorder(Color.RED, 3);
  
      public void moves() {
  
          for (int i = 0; i &lt;= 7; i++) {
              for (int j = 0; j &lt;= 7; j++) {
                  labels[i][j].addMouseListener(new MouseAdapter() {
                      @Override
                      public void mouseClicked(MouseEvent ee) {
                          labels[i][j].setBorder(border);
                      }
  
                  });
              }
          }
      }
  }
  </code></pre>
  
  <p>i'm getting the error in this line </p>
  
  <pre><code>labels[i][j].setBorder(border);
  </code></pre>
  
  <p>what i'm trying to do is changing the labels color borders when mouseEvent (clicked , pressed or dragged), and i need to use the i,j variables inside the mouseClicked method.</p>