Java 101The Console class
Java.io.Console class provides methods to access the character-based console device, if any, associated with the current Java Virtual Machine. This class is attached to the
System console internally.
Console class provide means to read text and passwords from the console.
To read a line as a
Console console = System.console(); String myString = console.readLine();
To read a password as an array of chars:
Console console = System.console(); char pw = console.readPassword();
If you read passwords using
Console class, it will not be displayed to the user.
Keep in mind that this class does not have a high level of security and it is mostly used at development stage.