Почему валидатор ругается что нет объекта типа TestThread в методе main?
TestThread testThread = new TestThread("Тестовая нить");
- если это не то? то какого типа я объект данной строчкой создаю
TestThread testThread = new TestThread("Тестовая нить");
testThread.start();
Thread.sleep(2000);
testThread.interrupt();
package com.javarush.task.task16.task1618;
/*
Снова interrupt
*/
public class Solution {
public static void main(String[] args) throws InterruptedException {
//Add your code here - добавь код тут
TestThread testThread = new TestThread("Тестовая нить");
testThread.start();
Thread.sleep(2000);
testThread.interrupt();
}
//Add your code below - добавь код ниже
public static class TestThread extends Thread {
private long ms = 0;
TestThread(String name){
super(name);
}
@Override
public void run() {
Thread thread = Thread.currentThread();
while (!thread.isInterrupted()){
System.out.println(ms++);
}
}
}
}