演示如何进行用户认证的 Java 程序
身份验证是验证用户或信息身份的过程。用户身份验证是在用户登录到计算机系统时验证用户身份的过程。身份验证的主要目标是允许授权用户访问计算机,并拒绝未经授权的用户访问。
例T0】
逼近
- A string with user name and password as user input.
- Check whether the user name and password match.
- If there is a match, users are welcome.
- Otherwise, display appropriate information.
下面是上述方法的实现
T3】JavaT5
// Java program to check the authentication of the user
// Importing the modules
import java.util.*;
// Gfg Class
public class Gfg
{
// Main CLass
public static void main(String args[])
{
// Declaring the username and password
String user_name = "Geeks For Geeks";
String password = "Geeks For Geeks";
// Checking the validity of the input
if(user_name.equals("Geeks For Geeks") && password.equals("Geeks For Geeks"))
{
// Printing Output
System.out.println("Authentication Successful");
}
else
{
// Printing Output
System.out.println("User name/ Password not matching");
}
}
}
T6T8输出T1
版权属于:月萌API www.moonapi.com,转载请注明出处