I am building a console application that checks for username and password before proceeding. However, by default, the characters typed in console will appear which is not good as I don't want to display the password the user types in. So, how can I hide or mask the password.
In this code snippet, I will show how we could mask the password. In short, I will read through the characters entered for password and mask it using empty characters. Backspace will still work as expected. If the user hits the Enter key, it will move on for the next prompt.