@@ -0,0 +1,2192 @@
+package com.njust.test.learn;%0A%0Aimport java.text.SimpleDateFormat;%0Aimport java.util.Date;%0A%0A/**%0A * notify%E9%9C%80%E8%A6%81%E9%80%80%E5%87%BA%E5%90%8C%E6%AD%A5%E4%BB%A3%E7%A0%81%E5%9D%97%E5%86%8D%E9%87%8A%E6%94%BE%E9%94%81%0A * -------------------------------%0A * %3Cpre%3E%0A * %5B14:14:03%5D waitTest ==%3E begin wait%0A * %5B14:14:03%5D notifyTest ==%3E begin notify%0A * %5B14:14:03%5D notifyTest ==%3E end notify%0A * %5B14:14:06%5D notifyTest ==%3E inner sleep end%0A * %5B14:14:06%5D waitTest ==%3E end wait%0A * %5B14:14:09%5D notifyTest ==%3E outer sleep end%0A *%0A * Process finished with exit code 0%0A * %3C/pre%3E%0A */%0Apublic class WaitNotifyDemo222%0A%7B%0A    public static void main(String%5B%5D args)%0A    %7B%0A        NotifyTest notifyTest = new NotifyTest();%0A        %0A        new Thread(notifyTest::waitTest).start();%0A        %0A        new Thread(notifyTest::notifyTest).start();%0A    %7D%0A%7D%0A%0Aclass NotifyTest%0A%7B%0A    public void waitTest()%0A    %7B%0A        synchronized (this)%0A        %7B%0A            try%0A            %7B%0A                printLog(%22waitTest ==%3E begin wait%22);%0A                this.wait();%0A                printLog(%22waitTest ==%3E end wait%22);%0A            %7D%0A            catch (InterruptedException e)%0A            %7B%0A                e.printStackTrace();%0A            %7D%0A        %7D%0A    %7D%0A    %0A    public void notifyTest()%0A    %7B%0A        synchronized (this)%0A        %7B%0A            printLog(%22notifyTest ==%3E begin notify%22);%0A            this.notify();%0A            //1.%E8%BF%99%E9%87%8C%E5%B7%B2%E7%BB%8F%E8%B0%83%E7%94%A8%E4%BA%86notify%0A            printLog(%22notifyTest ==%3E end notify%22);%0A            %0A            try%0A            %7B%0A                Thread.sleep(3000);%0A                printLog(%22notifyTest ==%3E inner sleep end%22);%0A                //2.%E8%BF%99%E9%87%8C%E6%89%8D%E9%80%80%E5%87%BA%E5%90%8C%E6%AD%A5%E4%BB%A3%E7%A0%81%E5%9D%97%0A            %7D%0A            catch (InterruptedException e)%0A            %7B%0A                e.printStackTrace();%0A            %7D%0A        %7D%0A        %0A        try%0A        %7B%0A            Thread.sleep(3000);%0A            printLog(%22notifyTest ==%3E outer sleep end%22);%0A            //3.%E7%BA%BF%E7%A8%8B%E7%BB%A7%E7%BB%AD%E6%89%A7%E8%A1%8C%E5%88%B0%E8%BF%99%E5%84%BF%EF%BC%8C%E4%B8%8D%E8%BF%87%E8%BF%99%E9%87%8C%E4%B8%8D%E5%9C%A8%E5%90%8C%E6%AD%A5%E4%BB%A3%E7%A0%81%E5%9D%97%E4%B8%AD%0A        %7D%0A        catch (InterruptedException e)%0A        %7B%0A            e.printStackTrace();%0A        %7D%0A    %7D%0A    %0A    //%E4%B8%BA%E4%BA%86%E8%AE%B0%E5%BD%95%E6%97%B6%E9%97%B4%E7%82%B9%0A    private void printLog(String msg)%0A    %7B%0A        SimpleDateFormat simpleDateFormat = new SimpleDateFormat(%22HH:mm:ss%22);%0A        String dateStr = simpleDateFormat.format(new Date());%0A        System.out.println(%22%5B%22 + dateStr + %22%5D %22 + msg);%0A    %7D%0A    %0A%7D%0A

Create WaitNotifyDemo222.java