Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- class Database {
- String[] userid = new String[2];
- {
- userid[0] = "admin";
- }
- Scanner input = new Scanner(System.in);
- int arrayindex = 1;
- String username;
- void Database(String invoke) {
- while (arrayindex < userid.length) {
- System.out.println("Register username");
- username = input.nextLine();
- userid[arrayindex] = username;
- arrayindex++;
- }
- }
- }
- public class App {
- public static void main(String[] args) {
- Database Machine = new Database();
- Scanner input = new Scanner(System.in);
- String login;
- int indexcount = 1;
- Machine.Database("invoke");
- System.out.println("enter login info");
- while (indexcount < Machine.userid.length) {
- login = input.nextLine();
- if (login.equals(Machine.userid[indexcount])) {
- System.out.println("logged in");
- indexcount++;
- } else {
- System.out.println("wrong account");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement