以下程序在静态同步方法和实例同步方法试图访问不同线程中同一类的静态字段的情况下会发生什么行为?任何线程都会被阻塞吗?它非常混乱。
class MyClass
{
public static int i = 5;
public synchronized void m1()
{
System.out.println(i); //uses static field i of MyClass
//T1 is executing this method
}
public static synchronized void m3()
{
//T2 will be able to call this method on same object lock while it is using
//static field i???
System.out.println(i);//uses static field i of MyClass
}
}