title: count++ not working in an if statement
body: <p>Trying to display an error message so that when the user enters the pin incorrect three times its will display the error message "account blocked". Why is pinAttempts++ not adding 1 each time the incorrect pin is entered?     </p>
  
  <pre><code>try {
      int pinAttempts = 0;
      int pin = Integer.parseInt(enterPinJTextField.getText());
      if (pinAttempts == 3) {
          JOptionPane.showMessageDialog(popupFrame, "Account blocked!");
      }
      if (pin != PIN) {
          pinAttempts++;
          JOptionPane.showMessageDialog(popupFrame, "Please enter correct pin!");
      } else {
          BankAccount application = new BankAccount();
          application.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      }
  } catch (NumberFormatException exception) {
      JOptionPane.showMessageDialog(popupFrame, "Please enter a number");
  }
  </code></pre>