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
为什么输出是 1 2 而不是 1 2 3。那边到底发生了什么?