⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 thread_wait.java

📁 gcc的组建
💻 JAVA
字号:
// Test basic thread creation and wait/notify functionality.public class Thread_Wait implements Runnable{  public static void main(String args[])  {    new Thread_Wait();  }    public Thread_Wait()  {    System.out.println("creating thread");    Thread t = new Thread(this);    t.start();        try    {      Thread.sleep(100);    }    catch (Exception x)    {      System.out.println("exception occurred: " + x);    }    synchronized (this)    {      System.out.println("notifying other thread");      notify();    }  }    public void run()  {    System.out.println ("new thread running");    synchronized (this)    {      try      {	wait();      }      catch (Exception x)      {        System.out.println("exception occurred: " + x);      }    }        System.out.println ("thread notified okay");  }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -