Advertisement
Guest User

Untitled

a guest
Apr 19th, 2014
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. JButton button=new JButton();
  2. int a=5;
  3. button.addActionListener(new ActionListener() {
  4.  
  5. @Override
  6. public void actionPerformed(ActionEvent arg0) {
  7. // TODO Auto-generated method stub
  8. System.out.println(""+a);//Compiler Error:Cannot refer to a non-final variable a inside an inner class defined in a different method
  9. }
  10. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement