ユーザーが数字のみを入力する必要がある以下のコードがあります。プログラムは動作していますが、問題は System.out.println("Mother's Age: ") がロード中に2回印刷されていることです
    while (count == 0){
        int x;
        System.out.println("Mother's Age: ");
        ans2 = input.nextLine();
        try{
            x = Integer.parseInt(ans2);
            System.out.println(count);                
            if (!(x >= 18 && x <= 45)) {
            }
            else{
                count = 1;
            }
        }
        catch (NumberFormatException nFE){
        }
    }