0
Follow
0
View

Use equals to check whether the accounts are identical. An error occurs when the id parameter is passed

Dengshuxian 注册会员
2023-02-25 19:05

First you call contains with two arguments. The second argument is the id of type String, but your method below contains lacks the id parameter. We need to fill in the String id for the method

img

liwandong0612 注册会员
2023-02-25 19:05

You didn't define an id in any of your methods, so you got an error

downgirl 注册会员
2023-02-25 19:05
; // 录入的账号 String[] existAccounts = { "123456" , "abcdef" }; // 已有的账号 boolean isExist = false; // 是否存在相同账号标志位 // 遍历已有的账号,使用equalsIgnoreCase方法来忽略大小写来检查账号录入与已有账号是否重复 for (String existAccount : existAccounts) { if (inputAccount.equalsIgnoreCase(existAccount)) { isExist = true; break ; } } if (isExist) { // 如果存在相同账号 System.out.println( "录入的账号重复" ); // 输出提示信息 } else { // 如果不存在相同账号 System.out.println( "录入的账号不重复" ); // 输出提示信息 }

If the answer is helpful, please accept it.