-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPassword Checker
More file actions
43 lines (38 loc) · 1.28 KB
/
Copy pathPassword Checker
File metadata and controls
43 lines (38 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import java.util.Scanner;
public class ExecutionFile{
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
System.out.print("Enter Your Password: ");
String pass = scan.nextLine();
if(pass.length()<8){
System.out.println("Invalid Password");
}else{
boolean uppercase = false;
boolean lowercase = false;
boolean digit = false;
for(int i=0;i<pass.length();i++){
char ch= pass.charAt(i) ;
if(Character.isUpperCase(ch)){
uppercase = true;
}
if(Character.isLowerCase(ch)){
lowercase = true;
}
if(Character.isDigit(ch)){
digit = true;
}
}
if(!uppercase){
System.out.println("Atleast 1 Uppercase Letter");
}
else if(!lowercase){
System.out.println("Atleast 1 Lowercase Letter");
}
else if(!digit){
System.out.println("Atleast 1 Digit");
}
else
System.out.println("Valid Password");
}
}
}