【发布时间】:2010-06-29 13:36:27
【问题描述】:
假设我们有一个简单的例子:
public Example extends Thread{
String temp;
public Example(){
}
@Override
public void run(){
.
.
.
.
temp = "a_value";
}
public static void main(String[] args) {
Example th = new Example();
th.start();
}
}
线程完成工作后如何将字符串临时返回给我?
【问题讨论】:
-
应该是
th.start()。而且您确实实现了一种从线程返回值的方法。
标签: java multithreading