Can I ask that is there any method to display asterisk (*) when user input their password, and store the password entered as String value in Java ? Thanks
import java.util.*;
public class Log_in_form {
Scanner scan=new Scanner(System.in);
public static void main(String[] args) {
String username="rosas";
String password="sandy";
System.out.println("Enter username");
String user=scan.next();
System.out.println("Enter password");
String pass=scan.next();
if(user.equals(username)&&(pass.equals(password))){
System.out.println("Log in success");
}
else{
System.out.println("log in failed");
}
}
}