제 질문은 혼란 스러울 수 있지만 실제로는 매우 간단합니다. 다른 Runnable 인스턴스를 시작하는 Runnable이 있습니다. 그래서 기본적으로 :Runnable 내에서 Runnable을 시작 하시겠습니까?
runnable1 -> runnable2 runnable2이 살아 또는 runnable1 마무리 할 때 runnable2가 시작 않는
이만큼 살아 남기 runnable1합니까?
Runnable runnable1;
Runnable runnable2;
runnable1 = new Runnable()
{
public void run()
{
runnable2 = new Runnable()
{
public void run()
{
//Code here
}
};
(new Thread(runnable2)).start();//Now that runnable 2 is started, does runnable 1 temrinate??
}
};
(new Thread(runnable1)).start();//This starts first
runnable2를 실행하는 스레드에서 join()을 호출하면 그렇지 않습니다. 그렇지 않은 경우 – white
신속한 응답을 보내 주셔서 감사합니다. 그래서 그대로두면 runnable1은 runnable2를 시작하자 마자 종료됩니다. 죄송합니다. 중복 확인 만하십시오. – Aci89
예, 맞습니다. – white