public static void main(String[] args) throws IOException {
BufferedWriter bw = new BufferedWriter(new FileWriter("work-code\data.txt"));
Scanner sc = new Scanner(System.in);
for (int i = 0; i < 3; i++) {
System.out.println("录入验证码:");
String s = sc.next();
bw.write(s);
bw.newLine();
}
bw.flush();
bw.close();
System.out.println("输入正确的验证码:");
String confirmation = sc.next();
BufferedReader br = new BufferedReader(new FileReader("work-code\data.txt"));
String len = null;
ArrayList list = new ArrayList<>();
while ((len = br.readLine()) != null){
list.add(len);
}
br.close();
if (list.contains(confirmation)){
System.out.println("验证成功");
}else {
System.out.println("验证失败");
}
}
鸿蒙传说
繁花不似锦
Qyouu
jeck猫
弑天下
相关分类