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 3 ではなく 1 2 になっているのはなぜですか。