简单线程问题---请教各位下
如何在Test2中取得est1中得参数msg值并赋值给message打印结果应给为 hello
========================================================
public class Test2 {
public static void main(String[] args) {
String message=null;
System.out.println("====="+message);
}
}
========================================================
public class Test1 implements Runnable{
private String msg=null; public void setValue(){
Thread t=new Thread();
t.start();
}
public void run() {
this.msg="hello";
}
}
========================================================
小弟对线程不是太熟悉,这题应该不难,却还摸了很久没搞定,希望路过得前辈指点下,最好能写出来。谢谢
如何在Test2中取得est1中得参数msg值并赋值给message打印结果应给为 hello
========================================================
public class Test2 {
public static void main(String[] args) {
String message=null;
System.out.println("====="+message);
}
}
========================================================
public class Test1 implements Runnable{
private String msg=null; public void setValue(){
Thread t=new Thread();
t.start();
}
public void run() {
this.msg="hello";
}
}
========================================================
小弟对线程不是太熟悉,这题应该不难,却还摸了很久没搞定,希望路过得前辈指点下,最好能写出来。谢谢
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货