线程!!!如何使线程处于等待状态,直到另一个线程唤起它。 public void run() { try { synchronized(this) { sleep(10000); } notifyAll(); } catch(InterruptedException e) { } }好像是这样吧! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 class WaitNotify extends Thread{ public WaitNotify() { } public synchronized void run() { while(true) { try { wait(1000); } catch (InterruptedException e){} } }}class Notifier extends Thread { private WaitNotify wn; public Notifier(WaitNotify wn) { this.wn = wn; start(); } public void run() { while(true) { try { sleep(2000); } catch (InterruptedException e){} synchronized(wn) { wn.notify(); } } }} 如何定位某个xml元素的后一个元素? 实体类在表示层的作用 那里有SQL Server 2000 Driver for JDBC的相关文档下载 Applet在网页中如何实现粘贴功能? 请问如何方便地加密class文件 准备结婚!她答应我了!散分!前两位有粉! 用java如何取得系统时间? java中多线程的问题 求MM MySQL JDBC Driver的文档 为什么?classpath 在BEAN中使用session.setAttribute出现个怪问题!!!!!!! applet 嵌入问题???
public WaitNotify() {
}
public synchronized void run() {
while(true) {
try {
wait(1000);
} catch (InterruptedException e){}
}
}
}class Notifier extends Thread {
private WaitNotify wn;
public Notifier(WaitNotify wn) {
this.wn = wn;
start();
}
public void run() {
while(true) {
try {
sleep(2000);
} catch (InterruptedException e){}
synchronized(wn) {
wn.notify();
}
}
}
}