java: 线程wait()方法
package com.chnfuture; class MyThread extends Thread{ MultiThread t = new MultiThread(); public void run(){ t.test(); System.out.println("Thread say:Hello,World!"); } } public class MultiThread { int x = 0; public synchronized void test(){ if(x==0) try{ wait(); }catch(Exception e){} } public static void main(String[] args) throws Exception{ new MyThread().start(); } }