public class Test{
public static void main(String args[]){
T1 t1=new T1(1);
t1.start();
T1 t2=new T1(2);
t2.start();
}
}
class T1 extends Thread{
public static Object o1=new Object();
public static Object o2=new Object();
int num;
T1(int num){
this.num=num;
}
public void run(){
if(num==1){
synchronized(o1){
System.out.println("1111111111111111");
synchronized(o2){
System.out.println("1end");
}
}
}else if(num==2){
synchronized(o2){
System.out.println("2222222222222222");
synchronized(o1){
System.out.println("2end");
}
}
}
}
}