我正在进行一项任务,并希望运行一个for循环来搜索用户名和密码进行验证,但我只能在使用我的第一套用户名和密码时登录,有人可以建议吗? / p>
for (KeyVal keyVal: suggestions()){
Criteria c =
Criteria.where("key").is(keyVal.key()).and("value").is(keyVal.value());
criteria = Criteria.where("data.suggestions").elemMatch(c);
}
答案 0 :(得分:0)
好吧我认为为什么用户名和密码是不可接受的,因为程序只是在arraylist的其余部分得到null,null,null。 这是我的编码
File file = new File("password.txt");
FileReader read = new FileReader(file);
String[][] matrix = new String[5000][5000];
int a1=0, a2=0;
BufferedReader in = new BufferedReader(read);
String line;
while ((line = in.readLine()) != null){ //file reading
String[] values = line.split(",");
for (String str : values)
{
matrix[a1][a2]=str;
System.out.println(matrix[a1][a2]);
a2++;
}
a1++;
a2=0; //must added after doing one loop of a1, otherwise a2 will keep counter.
}
是否有任何部分出错?