I\'m trying to figure out what i am doing wrong with action listeners. I\'m following multiple tutorials and yet netbeans and eclipse are giving me errors when im trying to
The first problem is that button1 is a local variable of the main method, so the actionPerformed method doesn't have access to it.
The second problem is that the ActionListener interface is implemented by the class calc, but no instance of this class is created in the main method.
The usual way to do what you want is to create an instance of calc and make button1 a field of the calc class.