title: Getting the name of a JButton on click
body: <pre><code>  @Override
    public void actionPerformed(ActionEvent e) {
        if (e.getSource() == thirdBtn) {
            //System.out.println("Third Button Click");
            System.out.println(e.getSource()+" Click");
        }
    }
  </code></pre>
  
  <p>In the code above, I was wondering if instead of doing this:</p>
  
  <pre><code>//System.out.println("Third Button Click");
  </code></pre>
  
  <p>if I could do something like this:</p>
  
  <pre><code>System.out.println(e.getSource()+" Click");
  </code></pre>
  
  <p>However the code outputs:</p>
  
  <pre><code>BlackJack.OverBoard$BlackJackButton[,440,395,100x25,alignmentX=0.0,alignmentY=0.5,
      border=javax.swing.plaf.BorderUIResource$CompoundBorderUIResource@7a3d8738,
      flags=16777504,maximumSize=,minimumSize=,preferredSize=,
      defaultIcon=,disabledIcon=,disabledSelectedIcon=,
      margin=javax.swing.plaf.InsetsUIResource[top=2,left=14,bottom=2,right=14],
      paintBorder=false,paintFocus=true,
      pressedIcon=,rolloverEnabled=true,rolloverIcon=,rolloverSelectedIcon=,selectedIcon=,
      text=Change,defaultCapable=true] Click
  </code></pre>
  
  <p>I don't want this, I want to know how to get the <code>JButton</code> name and output it on click.</p>
  
  <p><em><strong>EDIT:</em></strong></p>
  
  <p>Some people are confused. When I say "name" (maybe that's the wrong word for it), I meant say you initialize a <code>JButton</code></p>
  
  <pre><code>JButton btnExample = new JButton();
  </code></pre>
  
  <p>I want it so that when you click the button, it outputs <code>btnExample</code> in the console.</p>