Code example for Console

Methods: readPassword

0
         
         
        Console cons;
        char[] passwd;
        if ((cons = System.console()) != null &&
            (passwd = cons.readPassword("[%s]", "Password:")) != null) {
        	System.out.println(passwd);
            java.util.Arrays.fill(passwd, ' ');
        } 
  
    } 
} 
Connect your IDE to all the code out there  Get Codota for Java