Thursday, February 04, 2010

Get Password without displaying it on console

JDK 1.6 provides option to get secret inputs without displaying them on console. Here is the code sample to do that.



System.console().readPassword("[%s]", "Password:");

No comments: