public class ThreadConfusion
{
public static void main(String[] args)
{
System.out.print("1 ");
synchronized (args)
{
System.out.println(" 2");
try
{
args.wait();
}
catch (InterruptedException e)
{
System.out.println("exception");
}
}
System.out.println("3 ");
} //end of the main method
} // end of the class
1 2
爲何O/P爲1 2,而不是1 2 3發生了什麼事究竟 那邊我無能能任何1請向我解釋.. 謝謝你
你爲什麼叫wait()的?它等着你打電話通知() –
更重要的是:你期望調用'args.notify()'誰?這裏沒有其他線程... – ppeterka