-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlearn3.java
More file actions
32 lines (24 loc) · 932 Bytes
/
learn3.java
File metadata and controls
32 lines (24 loc) · 932 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
// Gagawa tayo ng authentication login system
import java.util.*;
class learn3{
public static void main(String[] args){
// input again.
Scanner input = new Scanner(System.in);
String user = "lento"; // kelangan lento for user, kun for pass ang itatype mo para mapunta sa true statement ng if.
String pass = "kun";
String a, b;
// eto yung loop na pabalik balik kapag hindi na execute ang tamang input.
auth:
for(x = 0; ; x++){
System.out.print("Enter Username: "); //Yung itatype mo pag mali babalik sa gantong itsura.
a = input.next();
System.out.print("Enter Password: ");
b = input.next();
if(a.equals(user) && b.equals(pass)){
System.out.println("Access Granted"); // pag tama eto lalabas.
} else {
System.out.println("Invalid User or Pass"); // pag mali babalik ka sa enter user and pass.
}
}
}
}