Skip to content

Commit dda76ec

Browse files
Password Strength Checker.java
1 parent e41dfd3 commit dda76ec

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

Password Strength Checker.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import java.util.regex.*;
2+
3+
public class PasswordChecker {
4+
public static void main(String[] args) {
5+
String pass = "Abcd1234@";
6+
7+
boolean strong = pass.length() >= 8 &&
8+
pass.matches(".*[A-Z].*") &&
9+
pass.matches(".*[a-z].*") &&
10+
pass.matches(".*\\d.*") &&
11+
pass.matches(".*[@#$%].*");
12+
13+
System.out.println(strong ? "Strong Password" : "Weak Password");
14+
}
15+
}

0 commit comments

Comments
 (0)