Write an application that accepts a users password from the
Solution
import java.util.Scanner;
public class PAsswordCheck {
   /* This method is used to valid password given by user
    * whether method contains character, letter and numeric value
    * if contains return true or false
    *
    * @param password
    * @return boolean
    */
    public static boolean isValid(String password) {
        int length = password.length();
        boolean letter = false;
        boolean number = false;
 //       check condition if character length 6-10
        if ((length >= 6) && (length <= 10)) {
            {
                for (int i = 0; i < length; i++) {
 //                   check condition if password contains digit or not
                    if (Character.isDigit(password.charAt(i))) {
                        number = true;
                    }
 //                   check condition if password contains letter or not
                    if (Character.isLetter(password.charAt(i))) {
                        letter = true;
                    }
                }
           }
        }
        else{
            System.out.println(\"condition failed!\");
        }
        return (number && letter);
       
       
}
   public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        System.out.println(\"Please enter a given password : \");
        String password = scan.nextLine();
        System.out.println(isValid(password));
        if (isValid(password)) {
            System.out.println(\"Please re-enter the password to confirm : \");
            String reEnter = scan.nextLine();
 //           match both password
            if (reEnter.equalsIgnoreCase(password)) {
                System.out.println(\"passowrd saved\");
            }
            else{
                System.out.println(\"Password not matched!\");
            }
        } else {
            System.out.println(\"Invalid Passowrd. Password \" + \"must contain atleast 1 letter\" + \" 1 digit, 1\"
                    + \" and \" + \"characters between 6-10 long\");
        }
        scan.close();
    }
   
}


