public class Syntest{
public static void main(
String []args){
final StringBuffer s1=new StringBuffer();
final StringBuffer s2=new StringBuffer();
new
Thread(){
public void run(){
synchronized(s1){
s1.append("a");
synchronized("b"){
System.out.println(s1);
System.out.println(s2);
}
}
}
}.start();
new Thread(){
public void run(){
synchronized(s2){
s2.append("c");
synchronized(s1){
s1.append("d");
System.out.println(s2);
System.out.println(s1);
}
}
}
}
.start();
}
}
a)print ABBCAD
b)print CDDACB
c)print ADCBADBC
d)The output is a not-deterministic point because of a
possible deadlock condition
e)The output is dependent on the threading model of
the ysstem the program is running on.
What could be the output of this question?.I go with D,E,correct me if i am wrong.