@@ -0,0 +1,571 @@
+import java.util.Scanner;%0Aimport java.util.regex.Matcher;%0Aimport java.util.regex.Pattern;%0A%0Apublic class P5Q3 %7B%0A    public static void main(String%5B%5D args) %7B%0A        System.out.print(%22Enter password : %22);%0A        Scanner scn = new Scanner(System.in);%0A        String pwd = scn.nextLine();%0A        Pattern rules = Pattern.compile(%22(?=.*%5B0-9%5D)(?=.*%5Ba-zA-Z%5D)(%5Ba-zA-Z0-9%5D%7B7,%7D)%22);%0A        Matcher matcher = rules.matcher(pwd);%0A        if(matcher.matches()) %7B%0A            System.out.println(%22Valid Password%22);%0A        %7D%0A        else System.out.println(%22Invalid Password%22);%0A    %7D%0A%7D

Use REGEX pattern matching