Import java.util.*;
public class Main {
public static void Main (string[] args) {
Main main= new Main ();
Menu start = new menu ();
Main.checkid ();
System.out.println ("Welcome". ");
Scanner sc = new Scanner (system.in);
int select = Sc.nextint ();
Switch (SELECT) {
Case 1:;
}
}
Check Login
private void Checkid () {
Used to read input
Scanner input = new Scanner (system.in);
Boolean loginStatus = false;
Number of password errors recorded
int count = 0;
while (LoginStatus = = False) {
if (Count >= 3) {
SYSTEM.OUT.PRINTLN ("error more than three times, account freezes");
System.exit (-1);
}
System.out.println ("Please enter your account:");
String name = Input.next ();
System.out.println ("Please enter password:");
String password = input.next ();
if ("admin". Equals (name) && "admin". Equals (password)) {
LoginStatus = true;
Remember to close the scanner.
Input.close ();
SYSTEM.OUT.PRINTLN ("Login Successful");
Break
} else {
System.out.println ("Incorrect account or password, please re-enter");
count++;
}
}
}
Exception in thread "main" java.util.NoSuchElementException
At Java.util.Scanner.throwFor (scanner.java:907)
At Java.util.Scanner.next (scanner.java:1530)
At Java.util.Scanner.nextInt (scanner.java:2160)
At Java.util.Scanner.nextInt (scanner.java:2119) more 0
? Welcome to join 618237474, find a group of private chat, send a huge amount of study materials free to send
Just learn Java white want to ask a question about reading the keyboard input numbers