简单的线程实例如下
package mythread;
public class Mythread extends Thread{
private String value1;
public void run(){
value1 = "str1";
}
}
例如我在另外一个swt界面程序,点击一下button,怎么获取前面线程的value1的值?
public void mouseDown(MouseEvent e) {
MyThread thread = new MyThread();
thread.start();
System.out.println("value1:"+thread.value1); //获取不到value1值
}
这样获取不到value1的值。。