答案是可以的。
public class Runner implements Runnable {
int b = 100;
public synchronized void m1() throws Exception{
b = 1000;
Thread.sleep(5000);
System.out.println(“b = ” + b);
}
public void m2(){
System.out.println(b);
}
@Override
public void run() {
try {
m1();
} catch (Exception e) {
e.printStackTrace();
}
}
}
public class Test {
public static void main(String[] args) throws InterruptedException {
Runner r = new Runner();
Thread t = new Thread(r);
t.start();
Thread.sleep(1000);
r.m2();
}
}



