Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Filename : ConsolePassword.java
- * @package : com.fivedots
- *
- * ConsolePassword is inside "Hello" project. Thus CD into the folder first, my case its "F:\workspace\Hello\"
- * - cd F:\workspace\Hello
- * - cd src
- * - javac "com/fivedots/ConsolePassword.java"
- * - java com.fivedots.ConsolePassword
- **/
- import java.io.Console;
- public class ConsolePassword {
- public static void main(String[] args) {
- Console cons = System.console();
- String username = cons.readLine("Enter username: ");
- char[] passwd = cons.readPassword("Enter password: ");
- System.out.println("Username :"+username);
- System.out.println("password :"+passwd);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement