输入日期继续重复java

输入日期继续重复java,java,date,user-input,Java,Date,User Input,我一直在做这个任务 这是我的密码: public void part2() { while (check) { try { System.out.println("Enter Payroll Period:\tSample: JAN-21-2016"); payperiod = input.nextLine(); period = payDate.parse(payperiod);

我一直在做这个任务 这是我的密码:

public void part2() {
    while (check) {
        try {
            System.out.println("Enter Payroll Period:\tSample: JAN-21-2016");
            payperiod = input.nextLine();
            period = payDate.parse(payperiod);
            payperiod = period.toString();
            Scanner error = new Scanner(System.in);
            String temp = "";
            int count = 0;
            char[] chtrs;
            Path file = Paths.get("Employee.txt");
            File location = new File(file.toString());
            FileReader employeeFile = new FileReader(location);
            BufferedReader lineReader = new BufferedReader(employeeFile);
            List<String> except = new ArrayList<>(), holdLast = new ArrayList<>();
            while ((temp = lineReader.readLine()) != null) {
                int cont = 0;
                for (char ime : temp.toCharArray()) {
                    char[] characters = new char[temp.toCharArray().length];
                    characters[cont] = temp.charAt(cont);
                    cont++;
                }
                except.add(temp);
                count++;
            }
            for (int i = 0; i < except.toArray().length && i == except.toArray().length; i++) {
                System.out.print("Enter number of days worked for " + except.toArray()[i] + ":\t");
                int numDays = input.nextInt();
                String thump = except.toArray()[i].toString() + " " + numDays;
                System.out.println(thump + " <- dude its in");
                holdLast.add(thump);
                System.out.println(except + " <- check errors except\n holdLast -> " + holdLast);
                check = false;
            }
        } catch (FileNotFoundException e) {
            System.err.println("NO RECORD EXISTS!");
            System.out.println("Create a new one first by choosing 1");
            MidActExam4 token = new MidActExam4();
            token.start();
        } catch (IOException e) {
            System.err.println(e.getMessage());
        } catch (Exception e) {
            System.err.println(e.getMessage() + e.getCause() + e.getStackTrace());
        }
    }
}

您永远不会进入内部循环,因此永远不会退出主循环:

for (int i = 0; i < except.toArray().length && i == except.toArray().length; i++) {
    ...
    check = false;
}
因为条件i 一个整数怎么可能小于一个值,同时又等于那个值


你可能是说我你的问题是什么?这是循环条件,多亏了@Gaël。我正在测试某个条件,谢谢你指出这一点。
for (int i = 0; i < except.toArray().length && i == except.toArray().length; i++) {
    ...
    check = false;
}