title: What's wrong with my password program?
body: <p>Helllo can somebody tell my why it doesn't tell my that the password is invalid, when I don't write the valid password?</p>
  
  <pre><code>import java.util.Scanner;
  
  public class Password {  
      private static Scanner in;
  
      public static void main(String[] args) {
          System.out.println("Please enter the password:");
          in = new Scanner (System.in);
          String pass;
          pass = in.nextLine();
          if(pass.length() &lt; 4){
              System.out.println("The password is too short");
  
          } else if(pass.length() &gt; 9){
              System.out.println("The password is too long");
  
          }
  
          if(pass.equalsIgnoreCase("hudhud")){
              System.out.println("Welcome BOSS");
              while (!pass.equals("hudhud")){
                  System.out.println("The password is invalid");
              }
          }
      }
  }
  </code></pre>