
Hi, how do i write a program that works with a user's password, when the program should prompt the user for a possible password, that is between 6 and 10 characters long, that contains at least one letter, and contains at least one digit?

Java Password Validation
import java.util.*;
import java.util.regex.*;
public class ValidatePassword{
public static void main(String[]args){
Scanner input=new Scanner(System.in);
System.out.print("Enter password: ");
String st=input.nextLine();
Pattern p = Pattern.compile("((?=.*\\d)(?=.*[a-z][A-Z]).{6,10})");
Matcher m = p.matcher(st);
if(m.find()){
System.out.println("Valid");
}
else{
System.out.println("Not Valid");
}
}
}