public class Transfers { <br /> public static void main(String[] args) throws Exception { <br /> Record r1 = new Record(); <br /> Record r2 = new Record(); <br /> doTransfer(r1, r2, 5); <br /> doTransfer(r2, r1, 2); <br /> doTransfer(r1, r2, 1); <br /> // print the result <br /> System.out.println(”rl = “ + r1.get() +“, r2=” + r2.get()); <br /> } <br /> private static void doTransfer( <br /> final Record a, final Record b, final int amount) { <br /> Thread t = new Thread() { <br /> public void run() { <br /> new Clerk().transfer(a, b, amount); <br /> } <br /> }; <br /> t.start(); <br /> }
A、 The output may be “r1 = 6, r2 = 14”.
B、 The output may be “r1 = 5, r2 = 15”.
C、 The output may be “r1 = 8, r2 = 12”.
D、 The code may run (and complete) with no output.
E、 The code may deadlock (without completing) with no output.
F、 M IllegalStateException or InterruptedException may be thrown at runtime.