通过SCJP的同志请进 ,请教一道同步题
public class Test2 extends Object implements Runnable {
String s1 = "Earth ";
String s2 = "Moon";
public void run() {
synchronized (s1) { //可以替换成synchronized(this),或synchronized(“hi”)
for (int i=0; i < 2; i++) {
s1.concat(" to Moon ");
System.out.print(s1);
s2.concat(" to Earth ");
System.out.println(s2);
}
}
}
public static void main(String[] args) {
Test2 t = new Test2();
new Thread(t).start();
new Thread(t).start(); }
}