+ 1

how to input as asterisk in Java

I like to know how to accept input like passwords/ pin codes as asterisk instead of seeing the the characters eg. Phy1233, on the screen. Want to see ********, which represents the same characters. class password { Public static void main (String args[]){ System.out.print(“Enter your password: ”); (Input code:............... please thanks); } }

23rd Apr 2019, 8:41 PM
KCode SubField
KCode SubField - avatar
2 Respuestas
+ 1
I think you can't do this if you want to enter password from terminal.. You can use some java libraries as Swing or JavaFX to enter the password using textfields They give an opportunity to hide a password
23rd Apr 2019, 8:46 PM
Владислав Крец
Владислав Крец - avatar
+ 1
ok any code simple code to assist, am use “JOptionPane library”. thanks
23rd Apr 2019, 9:02 PM
KCode SubField
KCode SubField - avatar