求助:一道考试题目
public class Test
{
int i = 0;
public static void main(String argv[])
{
Test t = new Test();
t.myMethod();
}
public void myMethod()
{
while(true)
{
try
{
wait();
}
catch (InterruptedException e)
{
}
i++;
}
}
}
答案是:Runtime Exception "IllegalMonitorStatException".
为什么?