I am trying to write a program which will allow two players to play “a guess word” game as part of my learning curve in Java.
When prompted, player 1 types in a word but the screen displays an asterisk * for each letter in the word. Simply player 1 types a word but the word should be displayed in asterisks rather than characters. I seem to have problem getting this one right.
Is there any method(s) in Stream Buffer or Scanner class that’ll allow me to do that above.
thank you.
The intuition that you should intercept input, save original data, and show it masked in the console. You can achieve that by separate thread working on it.
Use this reference http://java.sun.com/developer/technicalArticles/Security/pwordmask/
Magic happens in
EraserThreadclass.