my password program can hide keyboard input . its invisible when i type password.
But my qus is how can show password input as asterisk (*)
can any one help me please? :p
my code is here:
public void login()
{
Scanner input = new Scanner(System.in);//create Scanner object
System.out.println("\n");
Console console = System.console();
char[] ad_password = "admin".toCharArray();
char[] sm_password = "salesman".toCharArray();
char[] passwordEntered = console.readPassword("Enter Password To Access The Project ( As Admin / Sales Man ): ");
if (Arrays.equals(ad_password, passwordEntered))
{
System.out.println("\n Congratulation!!! Access granted \n");
System.out.println("\n Welcome Admin. :-) \n\n");
Shoping_mall obj_ad_dis=new Shoping_mall();
obj_ad_dis.ad_dis();
}
else if(Arrays.equals(sm_password, passwordEntered))
{
System.out.println("\n Congratulation!!! Access granted \n");
System.out.println("\n Welcome Sales Man. :-) \n\n");
Shoping_mall obj1_sm_dis=new Shoping_mall();
obj1_sm_dis.sm_dis();
}
else
{
System.out.println("\n Error: Your Password Doesn't Meet. Access Denied !!! :-( \n\n");
System.out.println("\n Enter Correct Password.\n\n");
Shoping_mall obj_login=new Shoping_mall();//creat object for calling Admin_works() method
obj_login.login();
}
}