@@ -0,0 +1,921 @@
+package com.sdw.soft.test.thread;%0D%0A/**%0D%0A * @author Sonicery_D%0D%0A * @date 2014%E5%B9%B411%E6%9C%8813%E6%97%A5%0D%0A * @version 1.0.0%0D%0A * @description%0D%0A **/%0D%0Apublic class Share %7B%0D%0A%0D%0A%09public synchronized void print(String str)%7B%0D%0A%09%09System.out.print(%22%5B%22+str);%0D%0A%09%09try %7B%0D%0A%09%09%09Thread.sleep(1000);%0D%0A%09%09%7D catch (InterruptedException e) %7B%0D%0A%09%09%09e.printStackTrace();%0D%0A%09%09%09System.out.print(%22thread interrupted ...%22);%0D%0A%09%09%7D%0D%0A%09%09System.out.print(%22%5D%22);%0D%0A%09%7D%0D%0A%09%0D%0A%09public static void main(String%5B%5D args) %7B%0D%0A%09%09Share share = new Share();%0D%0A%09%09Call call1 = new Call(%22A%22,share);%0D%0A%09%09Call call2 = new Call(%22B%22,share);%0D%0A%09%09Call call3 = new Call(%22C%22,share);%0D%0A%09%09Call call4 = new Call(%22D%22,share);%0D%0A%09%7D%0D%0A%7D%0D%0Aclass Call implements Runnable%7B%0D%0A%0D%0A%09private Share share;%0D%0A%09private String str;%0D%0A%09public Call(String str,Share share)%7B%0D%0A%09%09this.str = str;%0D%0A%09%09this.share = share;%0D%0A%09%09Thread thread = new Thread(this);%0D%0A%09%09thread.start();%0D%0A%09%7D%0D%0A%09@Override%0D%0A%09public void run() %7B%0D%0A%09%09share.print(str);%0D%0A%09%7D%0D%0A%09%0D%0A%7D

test Thead of sleep tenure the lock