title: The final local variable cannot be assigned, since it is defined in an enclosing type
body: <pre><code>ratingS = new JSlider(1, 5, 3); 
  ratingS.setMajorTickSpacing(1);
  ratingS.setPaintLabels(true);
  int vote;
  
  class SliderMoved implements ChangeListener {
      public void stateChanged(ChangeEvent e) {
          vote = ratingS.getValue();
      }
  }
  
  ratingS.addChangeListener(new SliderMoved());
  </code></pre>
  
  <p>If i write the above code Eclipse tells me this:</p>
  
  <blockquote>
    <p>Cannot refer to a non-final variable vote inside an inner class
    defined in a different method</p>
  </blockquote>
  
  <p>But if i add <strong>final</strong> before <strong>int vote</strong> it gives me this error:</p>
  
  <blockquote>
    <p>The final local variable vote cannot be assigned, since it is defined in an enclosing type</p>
  </blockquote>
  
  <p>So, how to solve?</p>