вот мой код и я добавил вывод в условие if
public void run() {
while (true) {
System.out.println(this);
if (--countdownIndex == 0) {
System.out.println("Нить прервана");\\\\\\\\\\\\\\\\\\------
return;
}
try {
Thread.sleep(10);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
}
и по достижению 0 выводит нить прервана, а в решении по другому и не выводит текста нить прервана
public void run() {
while (true) {
System.out.println(this);
if (--countdownIndex == 0) return;
try {
Thread.sleep(10);
} catch (InterruptedException e) {
System.out.println("Нить прервана");
return;
}
}
}