title: How to efficiently check if two Strings are the same and that non of them is empty
body: <p>I think this is the longer, tedious and inefficient way to check:</p>
  
  <ul>
  <li>that password fields are not empty</li>
  <li>that both passwords match</li>
  <li>that both passwords are not the same</li>
  </ul>
  
  <hr>
  
  <pre><code>private void checkPasswordSame() {
          String first = password1.getText();
          String second = password2.getText();
          if (first.equals("")) {
              System.out.println("Password can't be empty");
  
              if ("".equals(second)) {
                  System.out.println("Second password is empty");
              }
          } else if (first.equals(second)) {
              System.out.println("Passwords same");
          } else {
              System.out.println("Passwords not the same");
          }
  
  }
  </code></pre>
  
  <p>Is there a way I can do this in fewer lines?</p>