title: How to return a boolean method in java?
body: <p>I need help on how to return a boolean method in java. This is the sample code:</p>
  
  <pre><code>public boolean verifyPwd(){
          if (!(pword.equals(pwdRetypePwd.getText()))){
                    txtaError.setEditable(true);
                    txtaError.setText("*Password didn't match!");
                    txtaError.setForeground(Color.red);
                    txtaError.setEditable(false);
             }
          else {
              addNewUser();
          }
          return //what?
  }
  </code></pre>
  
  <p>I want the <code>verifyPwd()</code> to return a value on either true or false whenever I want to call that method. I want to call that method like this:</p>
  
  <pre><code>if (verifyPwd()==true){
      //do task
  }
  else {
      //do task
  }
  </code></pre>
  
  <p>How to set the value for that method? </p>