Всем привет! Валидатор принял у меня код ниже. При этом, сам код не рабочий - вечный цикл. Валидатору конечно виднее, но я бы хотел понять, почему цикл вечный? Помогите, пожалуйста разобраться. Ведь я не использую метод Thread.sleep() в своём методе run().
package com.javarush.task.task16.task1618;
/*
Снова interrupt
*/
public class Solution {
public static void main(String[] args) throws InterruptedException {
TestThread test = new TestThread();
test.start();
Thread.sleep(5000);
test.interrupt();//Add your code here - добавь код тут
}
//Add your code below - добавь код ниже
public static class TestThread extends Thread{
int count;
Thread current = Thread.currentThread();
@Override
public void run(){
System.out.println("Нить запущена");
while (!current.isInterrupted()){
System.out.println(count);
count++;
}
}
}
}