매개 변수를 Runnable에 전달하는 방법을 알고 있습니다. 하지만 내 스레드가 실행되면 프로세스의 결과를 얻는 방법은 무엇입니까?
class Some implements Runnable
{
int p;
int endresult = 0;
public Some(int param){
p = param;
}
public void run(){
//do something
endresult += p;
//Now how to let the method who executed this runnable know that the result is 2;
}
}
Some s = new Some(1);
Thread t = new Thread(s);
t.start();
t가 끝나면 'endresult'변수를 가져오고 싶습니다.
정말 도움이 될만한 사람이 있습니까? –