title: How do I make sure that a block of code only executes ONCE and only ONCE. And NEVER AGAIN
body: <p>I've tried creating a public static variable (NOT LOCAL) and purposely making an increment to it and telling Java:</p>
  
  <p>"If this variable == 0, then execute this code"</p>
  
  <p>so that even if that method is called the second time, that block of code won't execute because the variable has changed and is no longer zero... and it will never again be zero because it keeps increasing.</p>
  
  <pre><code>public void actionPerformed(ActionEvent e){
    if(e.getSource()==deal){/*do something*/}
  }
  </code></pre>
  
  <p>My problem is that the if statment executes more than once when I press the button "deal".</p>