Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * A.C. Silvestri
- * 10/14/2017
- * Username/Password Authentication code
- * Chapter 4 Strings Demo
- */
- import java.util.Scanner;
- public class Login {
- private static void workTheSystem() {
- System.out.println("You are manipulating the system ...");
- }
- public static void main(String[] args) {
- String username, password;
- Scanner input = new Scanner(System.in);
- System.out.print("Enter Username: ");
- username = input.nextLine();
- System.out.print("Enter Password: ");
- password = input.nextLine();
- input.close();
- username = username.trim();
- password = password.trim();
- if (username.equalsIgnoreCase("admin") &&
- password.equals("12345")) {
- System.out.println("You are authorized to use this system.");
- workTheSystem();
- }
- else {
- System.out.println("Credentials invalid. Go away.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement