java实现登录系统页面
下面是一个简单的Java实现登录系统页面的示例:
import java.util.Scanner;
public class LoginSystem {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String username = "admin";
String password = "123456";
System.out.println("Welcome to the login system!");
System.out.print("Please enter your username: ");
String inputUsername = scanner.nextLine();
System.out.print("Please enter your password: ");
String inputPassword = scanner.nextLine();
if (inputUsername.equals(username) && inputPassword.equals(password)) {
System.out.println("Login successful!");
} else {
System.out.println("Login failed. Invalid username or password.");
}
scanner.close();
}
}
这个简单的登录系统页面要求用户输入用户名和密码,然后与预设的用户名和密码进行比较。如果用户名和密码匹配,则登录成功;否则登录失败。
AI 优化版
原文地址:https://www.cveoy.top/t/topic/brkn 著作权归作者所有。请勿转载和采集!