I am making Java Swing application. i made check box item, then when i was calling show.isSelected()
method, i got an error that you have to make show final, then i made it final and the error was gone, the error was in the 9th line, but i did not understand that what was the reason for making show final and what final does with show ?
final JCheckBoxMenuItem show=new JCheckBoxMenuItem("Show");
show.setSelected(true);
show.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent arg0)
{
formpanel.setVisible(show.isSelected()); ////// giving error without final
}
});