Using the New java.io.Console Class
The 1.6 release of the JDK included a new java.io.Console class, which adds some new features to enhance and simplify command-line applications. Notably, Console includes a method specifically for reading passwords that disables console echo and returns a char array; both important for security. Scenario: Getting Username and PasswordGetting a user’s username and password is probably one of the more common …