1. public class SyncTest{
2. public static void main(
String[] args)}
3.����final StringBuffer s1=new StringBuffer();
4.����final StringBuffer s2=new StringBuffer();
5.����new
Thread() {
6.������ public void run(){
7.���������� synchronized(s1){
8������������������ s1.append(��A��);
9���������������� Synchronized(s2){
10�������������������� s2.append(��B��);
11���������������� System.out.print(s1);
12���������������� System.out.print(s1);
13���������������� }
14������������}
15����������}
16������ }.start();
17���� new Thread(){
18��������public void run(){
19.������������Synchronized(s2){
20.���������������� s2.append(��c��);
21.���� Synchronized(s1){
22.�������� s1.append(��D��);
23.�������� System.out.println(s2);
24.�������� System.out.println(s1);
25.�������� }
26.����}
27.�� }
28. }.start();
29.��}
30. }
thread question without syncronized keyword(choose 2)
a) the program prints ��ABBCAD��
b) the program prints ��CDDACB��
c) the program prints ��ADCBADBC��
d) the output is non-deterministic point because of a possible deadlock
e)the output is dependent on the threading model of the system that the program is running on
what's the anser? thx u!