Непонятно, вроде сделал все по условию.
package com.javarush.task.task16.task1617;
/*
Отсчет на гонках
*/
public class Solution {
public static volatile int numSeconds = 3;
public static void main(String[] args) throws InterruptedException {
RacingClock clock = new RacingClock();
Thread.sleep(3500);
clock.interrupt();
}
public static class RacingClock extends Thread {
public RacingClock() {
start();
}
public void run() {
while (!Thread.currentThread().isInterrupted()){
try {
Thread.sleep(1000);
numSeconds--;
} catch (InterruptedException e) {
e.printStackTrace();
}
}
if (numSeconds == 3){
System.out.println("3 2 1 Марш!");
}else if(numSeconds == 4){
System.out.println("4 3 2 1 Прервано!");
}
}
}
}