日期:2014-05-20 浏览次数:20677 次
public class Test { public static void main(String[] args) { new NewThread().start(); SynchronizedClass cc=new SynchronizedClass(); cc.p(); } } class SynchronizedClass{ public synchronized void p(){ System.out.println("fuck"); try { //Thread t=new Thread(); this.wait(10000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } class NewThread extends Thread{ @Override public void run() { SynchronizedClass sc=new SynchronizedClass(); sc.p(); } }