gpt4 book ai didi

java - 找不到方法的符号错误

转载 作者:行者123 更新时间:2023-11-29 05:57:05 24 4
gpt4 key购买 nike

<分区>

我的代码有问题。我需要从一个 txt 文件中读取数据。用户将输入他的用户名和密码,系统将检查存储在文本文件中的信息以进行验证,一旦成功,他将登录。但是我有一个错误,我不确定如何继续。

public class existingCustomers {

String username, password;

public existingCustomers() {
Scanner input = new Scanner(System.in);

System.out.println("Welcome to Kreg Hotel booking System");
System.out.println("Please login.");
System.out.println("==============================================");
System.out.println("Username: ");
username = input.nextLine();
System.out.println("Password: ");
password = input.nextLine();
new userPassOk(username, password);
}

private boolean userPassOk(String user, String pass) throws FileNotFoundException {
Scanner s = new Scanner(new File("customerinfo.txt"));
username = user;
password = pass;
while (s.hasNextLine()) {
String[] userPass = s.nextLine().split(":");
if (userPass[0].equals(user) && userPass[1].equals(pass))
return true;
}
return false;
}
}

我的错误是

C:\Users\MegaStore\Desktop\java testing\existingCustomers.java:18: error: cannot find symbol
new userPassOk(username,password);
^
symbol: class userPassOk
location: class existingCustomers
1 error

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com