-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpasswordsystem.java
More file actions
36 lines (28 loc) · 933 Bytes
/
Copy pathpasswordsystem.java
File metadata and controls
36 lines (28 loc) · 933 Bytes
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
import java.util.Scanner;
public class passwordsystem {
public static void main(String[] args)
{
Scanner scanner=new Scanner(System.in);
System.out.println("CREATE YOUR PASSWORD");
String cpassword=scanner.nextLine();
System.out.println("ENTER THE PASSWORD");
String password=scanner.nextLine();
if(password.equals(cpassword))
{
System.out.println("ACCESS GRANTED");
}
else
{
for(int i=0;i<5;i++)
{
System.out.println("WRONG PASSWORD. ACCESS DENIED TRY AGAIN");
password=scanner.nextLine();
if(password.equals(cpassword))
{
System.out.println("ACCESS GRANTED");
break;
}
}
}
}
}