-2

I am developing a online order management system in java connecting MySql to run in console where I need to login using userid and password. so, here I need to mask the password while typing in console. can anyone pls, help me with this?

2 Answers2

0

The class Console has a method readPassword() that might be helpful in your case.

Helix112
  • 305
  • 3
  • 12
0

char[] password = System.console().readPassword("password:");

notice: you can't run this code in IDE, you have to execute on terminal.

hua
  • 169
  • 9