作者在 2017-05-28 13:44:05 发布以下内容
public class passwordVerify {
public static void main(String[] args)
{
// TODO Auto-generated method stub
verify();
}
public static void verify()
{
String originalUserName = "cs1053283896@gmail.com" ; //账号密码信息
String originalUserPassword = "123456789" ;
Scanner myscanner = new Scanner(System.in);
String userName,userPassword;
System.out.println("请输入账号:"); //输入信息
userName=myscanner.next();
System.out.println("请输入密码:");
userPassword=myscanner.next();
userName=userName.trim(); //去除空格字符串头部尾部的空格
userPassword=userPassword.trim();
if(!userName.equals(originalUserName)) //检验账号
System.out.println("用户名输入错误,请重新输入");
else if(!userPassword.equals(originalUserPassword)) //检验密码
System.out.println("密码输入错误,请重新输入");
else //用户名、密码输入正确
{
int index = originalUserName.indexOf('@');
String name = originalUserName.substring(0, index);
System.out.println("验证通过,"+name+",欢迎回来");
}
}
public static void main(String[] args)
{
// TODO Auto-generated method stub
verify();
}
public static void verify()
{
String originalUserName = "cs1053283896@gmail.com" ; //账号密码信息
String originalUserPassword = "123456789" ;
Scanner myscanner = new Scanner(System.in);
String userName,userPassword;
System.out.println("请输入账号:"); //输入信息
userName=myscanner.next();
System.out.println("请输入密码:");
userPassword=myscanner.next();
userName=userName.trim(); //去除空格字符串头部尾部的空格
userPassword=userPassword.trim();
if(!userName.equals(originalUserName)) //检验账号
System.out.println("用户名输入错误,请重新输入");
else if(!userPassword.equals(originalUserPassword)) //检验密码
System.out.println("密码输入错误,请重新输入");
else //用户名、密码输入正确
{
int index = originalUserName.indexOf('@');
String name = originalUserName.substring(0, index);
System.out.println("验证通过,"+name+",欢迎回来");
}
}