
* 겪고 있는 문제 상황을 최대한 자세하게 작성해주세요.
* 문제 해결을 위해 어떤 시도를 해보았는지 구체적으로 함께 알려주세요.
"sleep이 static method라서 특정 thread만 멈추게 할 수 없고 Thread 클래스 전체를 멈추게 한다." 라고 말씀해주셨는데,
Static method는 객체 생성 없이 사용 할 수 있는 메서드라고만 배워서... 어떤 의미인지 이해가 되지 않습니다.
static method의 다른 기능이 있는걸까요?

public class Main {
public static void main(String[] args) {
Runnable task = () -> {
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println("task : " + Thread.currentThread().getName());
};
Thread thread = new Thread(task, "Thread");
thread.start();
try {
thread.sleep(1000);
System.out.println("sleep(1000) : " + Thread.currentThread().getName());
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
