title: The final local variable cannot be assigned
body: <p>I have an array of seats, and the array has two strings(selected and empty). On mouse click, I want to traverse the array and find the selected seat. When I press the button it says: </p>
  
  <blockquote>
    <p>The final local variable seatno cannot be assigned, since it is defined in an enclosing type.</p>
  </blockquote>
  
  <pre><code>    JButton btnContinue = new JButton("Next");
      btnContinue.addMouseListener(new MouseAdapter() {
          public void mouseClicked(MouseEvent arg0) {
  
              for(int x=0;x&lt;17;x++){
                  if(anArray[x]=="selected"){
  
                      seatno = anArray[x];
                  }
              }
  
              data page=new data(newfrom,newto,newtime,date2,seatno);
              page.setVisible(true);
              setVisible(false);
          }
      });
      btnContinue.setBounds(358, 227, 62, 23);
      contentPane.add(btnContinue);
  </code></pre>