public char[] readPassword(){
synchronized (CONSOLE_LOCK) {
    int previousState=setEcho(false,0);
    try {
      String password=readLine();
      writer.println();
      return (password == null) ? null : password.toCharArray();
    }
  finally {
      setEcho(true,previousState);
    }
  }
}

public char [ ] readPassword ( ) { synchronized ( CONSOLE_LOCK ) { int previousState = setEcho ( false , 0 ) ; try { String password = readLine ( ) ; writer . println ( ) ; return ( password == null ) ? null : password . toCharArray ( ) ; } finally { setEcho ( true , previousState ) ; } } }
reads a password from the console . the password will not be echoed to the display .
