Не понимаю, что не нравится валидатору. Вывод в консоль правильный
package com.javarush.task.task16.task1617;
/*
Отсчет на гонках
*/
public class Solution {
public static volatile int numSeconds = 4;
public static void main(String[] args) throws InterruptedException {
RacingClock clock = new RacingClock();
Thread.sleep(3500);
clock.interrupt();
//add your code here - добавь код тут
}
public static class RacingClock extends Thread {
public RacingClock() {
start();
}
public void run() {
if (numSeconds <= 3) {
for (int i = numSeconds; i > 0; i--) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.print(i + " ");
}
System.out.print("Марш!");
}
if (numSeconds > 3) {
while (!Thread.currentThread().isInterrupted()) {
for (int i = numSeconds; i > 0; i--) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.print(i + " ");
}
Thread.currentThread().interrupt();
System.out.print("Прервано!");
}
}
//add your code here - добавь код тут
}
}
}