0

in java, how to hide password with java.util.Scanner ?

CAUTION: I need not use java.io.Console solution

Scanner input = new Scanner(System.in);
System.out.println("What is your password?");
password = input.nextLine();

is it possible to overide Scanner (org.junit.contrib.java.lang.system.StandardOutputStreamLog)?

is it possible use a other mask system (by an other thread (add * by overide)?

Stéphane GRILLON
  • 11,140
  • 10
  • 85
  • 154

1 Answers1

0

If you are looking to do this within an IDE, your best bet is using a JPasswordField. Although this is a GUI solution, it solves the problem without having to use java.io.Console.

Ryan Walden
  • 167
  • 10