title: how to fix the cannot find symbol in actionPerformed method?
body: <pre><code>import javax.swing.*;
  
  import java.awt.*;
  import java.awt.event.*;
  
  class MyCalculator extends JFrame implements ActionListener {
     static JFrame jf;
     static JTextField t;
  
     static double a = 0, b = 0, result = 0;
     static int operation = 0;
  
     MyCalculator() {
         jf = new JFrame(&quot;MyCalculator&quot;);
         try {
             UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
         } catch (Exception e) {
             System.out.println(e.getMessage());
         }
  
         t = new JTextField(10);
         t.setBounds(50, 10, 200, 50);
         t.setEditable(false);
  
  
         JPanel p = new JPanel();
  
         JButton b1, b2, b3, b4, b5, b6, b7, b8, b9, b0, badd, bsub, bmul, bdiv, beq, be, bclr;
  
         b1 = new JButton(&quot;1&quot;);
         b2 = new JButton(&quot;2&quot;);
         b3 = new JButton(&quot;3&quot;);
         b4 = new JButton(&quot;4&quot;);
         b5 = new JButton(&quot;5&quot;);
         b6 = new JButton(&quot;6&quot;);
         b7 = new JButton(&quot;7&quot;);
         b8 = new JButton(&quot;8&quot;);
         b9 = new JButton(&quot;9&quot;);
         b0 = new JButton(&quot;0&quot;);
         badd = new JButton(&quot;+&quot;);
         bsub = new JButton(&quot;-&quot;);
         bmul = new JButton(&quot;*&quot;);
         bdiv = new JButton(&quot;/&quot;);
         beq = new JButton(&quot;=&quot;);
         be = new JButton(&quot;.&quot;);
         bclr = new JButton(&quot;C&quot;);
  
         p.add(t);
         p.add(bclr);
         p.add(b1);
         p.add(b2);
         p.add(b3);
         p.add(badd);
         p.add(b4);
         p.add(b5);
         p.add(b6);
         p.add(bsub);
         p.add(b7);
         p.add(b8);
         p.add(b9);
         p.add(bmul);
         p.add(be);
         p.add(b0);
         p.add(beq);
         p.add(bdiv);
  
         p.setBackground(Color.blue);
  
         jf.add(p);
         jf.setSize(210, 210);
         jf.setVisible(true);
  
         b1.addActionListener(this);
         b2.addActionListener(this);
         b3.addActionListener(this);
         badd.addActionListener(this);
         b4.addActionListener(this);
         b5.addActionListener(this);
         b6.addActionListener(this);
         bsub.addActionListener(this);
         b7.addActionListener(this);
         b8.addActionListener(this);
         b9.addActionListener(this);
         bmul.addActionListener(this);
         be.addActionListener(this);
         b0.addActionListener(this);
         beq.addActionListener(this);
         bdiv.addActionListener(this);
         bclr.addActionListener(this);
     }
  
     @Override
     public void actionPerformed(ActionEvent e) {
         if (e.getSource() == b1) {
             t.setText(t.getText().concat(&quot;1&quot;));
         }
         if (e.getSource() == b2) {
             t.setText(t.getText().concat(&quot;2&quot;));
         }
         if (e.getSource() == b3) {
             t.setText(t.getText().concat(&quot;3&quot;));
         }
         if (e.getSource() == b4) {
             t.setText(t.getText().concat(&quot;4&quot;));
         }
         if (e.getSource() == b5) {
             t.setText(t.getText().concat(&quot;5&quot;));
         }
         if (e.getSource() == b6) {
             t.setText(t.getText().concat(&quot;6&quot;));
         }
         if (e.getSource() == b7) {
             t.setText(t.getText().concat(&quot;7&quot;));
         }
         if (e.getSource() == b8) {
             t.setText(t.getText().concat(&quot;8&quot;));
         }
         if (e.getSource() == b9) {
             t.setText(t.getText().concat(&quot;9&quot;));
         }
         if (e.getSource() == b0) {
             t.setText(t.getText().concat(&quot;0&quot;));
         }
         if (e.getSource() == be) {
             t.setText(t.getText().concat(&quot;.&quot;));
         }
         if (e.getSource() == badd) {
             a = Double.parseDouble(t.getText());
             operation = 1;
             t.setText(&quot;&quot;);
             String s = &quot;&quot;;
             s = Double.toString(a);
         }
         if (e.getSource() == bsub) {
             a = Double.parseDouble(t.getText());
             operation = 2;
             t.setText(&quot;&quot;);
             String s = &quot;&quot;;
             s = Double.toString(a);
         }
         if (e.getSource() == bmul) {
             a = Double.parseDouble(t.getText());
             operation = 3;
             t.setText(&quot;&quot;);
             String s = &quot;&quot;;
             s = Double.toString(a);
         }
         if (e.getSource() == bdiv) {
             a = Double.parseDouble(t.getText());
             operation = 4;
             t.setText(&quot;&quot;);
             String s = &quot;&quot;;
             s = Double.toString(a);
         }
         if (e.getSource() == beq) {
             b = Double.parseDouble(t.getText());
  
             switch (operation) {
                 case 1:
                     result = a + b;
                     break;
                 case 2:
                     result = a - b;
                     break;
                 case 3:
                     result = a * b;
                     break;
                 case 4:
                     result = a / b;
                     break;
                 default:
                     result = 0;
             }
             t.setText(&quot;&quot; + result);
  
         }
         if (e.getSource() == bclr) {
             t.setText(&quot;&quot;);
             String s = &quot;&quot;;
             t.setText(&quot;&quot;);
         }
     }
  
     public static void main(String args[]) {
         MyCalculator c = new MyCalculator();
         jf.setVisible(true);
  
     }
  }
  </code></pre>
  <p>Error:</p>
  <pre><code>MyCalculator.java:104: error: cannot find symbol
    if(e.getSource()==b1)
                      ^
    symbol:   variable b1
    location: class MyCalculator
  MyCalculator.java:108: error: cannot find symbol
    if(e.getSource() == b2)
                        ^
    symbol:   variable b2
    location: class MyCalculator
  MyCalculator.java:112: error: cannot find symbol
    if(e.getSource() == b3)
                        ^
    symbol:   variable b3
    location: class MyCalculator
  MyCalculator.java:116: error: cannot find symbol
    if(e.getSource() == b4)
                        ^
    symbol:   variable b4
    location: class MyCalculator
  MyCalculator.java:120: error: cannot find symbol
    if(e.getSource() == b5)
                        ^
    symbol:   variable b5
    location: class MyCalculator
  MyCalculator.java:124: error: cannot find symbol
    if(e.getSource() == b6)
                        ^
    symbol:   variable b6
    location: class MyCalculator
  MyCalculator.java:128: error: cannot find symbol
    if(e.getSource() == b7)
                        ^
    symbol:   variable b7
    location: class MyCalculator
  MyCalculator.java:132: error: cannot find symbol
    if(e.getSource() == b8)
                        ^
    symbol:   variable b8
    location: class MyCalculator
  MyCalculator.java:136: error: cannot find symbol
    if(e.getSource() == b9)
                        ^
    symbol:   variable b9
    location: class MyCalculator
  MyCalculator.java:140: error: cannot find symbol
    if(e.getSource() == b0)
                        ^
    symbol:   variable b0
    location: class MyCalculator
  MyCalculator.java:144: error: cannot find symbol
    if(e.getSource() == be)
                        ^
    symbol:   variable be
    location: class MyCalculator
  MyCalculator.java:148: error: cannot find symbol
    if(e.getSource() == badd)
                        ^
    symbol:   variable badd
    location: class MyCalculator
  MyCalculator.java:156: error: cannot find symbol
      if(e.getSource() == bsub)
                          ^
    symbol:   variable bsub
    location: class MyCalculator
  MyCalculator.java:164: error: cannot find symbol
      if(e.getSource() == bmul)
                          ^
    symbol:   variable bmul
    location: class MyCalculator
  MyCalculator.java:172: error: cannot find symbol
      if(e.getSource() == bdiv)
                          ^
    symbol:   variable bdiv
    location: class MyCalculator
  MyCalculator.java:180: error: cannot find symbol
      if(e.getSource() == beq)
                          ^
    symbol:   variable beq
    location: class MyCalculator
  MyCalculator.java:204: error: cannot find symbol
      if(e.getSource() == bclr)
                          ^
    symbol:   variable bclr
    location: class MyCalculator
  17 errors
  </code></pre>