Не могу понять что не нравится валидатору. Вроде все нормально выводится, пробовал и с print() и println() выводить "Марш!". Халп, спасибо!
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);
if(!clock.isInterrupted()) {
clock.interrupt();
System.out.println("Прервано!");
}
//add your code here - добавь код тут
}
public static class RacingClock extends Thread {
public RacingClock() {
start();
}
public void run() {
//add your code here - добавь код тут
while (!currentThread().isInterrupted()) {
try {
if (numSeconds == 0) {
System.out.print("Марш!");
currentThread().interrupt();
} else {
System.out.print(numSeconds + " ");
}
Thread.sleep(1000);
numSeconds--;
} catch (Exception ignored) {
currentThread().interrupt();
}
}
}
}
}