Card 23 / 32: public class Test116 { static final StringBuffer sb1 = new StringBuffer(); static final StringBuffer sb2 = new StringBuffer(); public static void main(String[] args) { new Thread(){ public void run(){ synchronized (sb1) { sb1.append("A"); sb2.append("B"); } } }.start(); new Thread(){ public void run(){ synchronized (sb1) { sb1.append("C"); sb2.append("D"); } } }.start(); System.out.println(sb1+" "+sb2); } }
A)
AB CD
B)
BC DA
C)
AC BD
D)
ADBC
Answer:
C) AC BD
Previous Card | ← Previous Card Button |
Next Card | → Next Card Button |
Flip Card | Space-Bar |
|