关于多线程的问题?

tomguan 2004-02-19 05:15:00
public class WaitNotify extends Thread {

public static void main(String[] args) {
Thread notificationThread = new WaitNotify();
notificationThread.start();
try {

synchronized (notificationThread) {
System.out.println("before run wait method!");
//notificationThread.wait();
System.out.println("after run wait method!");
}
} catch (Exception e) {

}
System.out.println("the wait is over");
}
public void run() {
System.out.println("Hit enter to stop waiting thread!");

try {
System.in.read();
} catch (Exception e) {

}
synchronized (this) {
this.notifyAll();
}

}

}

请问在上面的程序运行时,总共有几个线程啊,都是那些个?
这个程序到底是怎么运行的啊(线程方面),我现在都晕了,拜托各位大哥了!
...全文
73 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复

62,616

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧