class TestThread{

public static void main(String[] args){
final Foo f = new Foo();
Thread t= new Thread(){
public void run(){
f.dostuff();
}
};
Thread g = new Thread(){
public void run(){
f.dostuff();
    }
};
t.start();
g.start();
}

}class Foo
{
int x = 5;
public void dostuff(){
if(x<0){
try{
wait();
}
catch (InterruptedException w){
}
}
else{
System.out.println("x is "+ x++);
if (x>10){
notify();
}
}
}}
在机器上跑了跑,居然得到x is 5
x is 6不是没有锁的话就要抛出IllgalMonitorException异常的吗?