複選題
235. Given: 11. public class PingPong implements Runnable{ 12. synchronized void hit(long n){ 13. for(int i=1; i<3; i++) 14. System.out.print(n + "-" + i + " "); 15. } 16. public static void main(String[] args){ 17. new Thread(new PingPong()).start(); 18. new Thread(new PingPong()).start(); 19. } 20. public void run(){ 21. hit(Thread.currentThread().getId); 22. } 23. } Which two statements are true? (Choose two.)
(A) The output could be 8-1 7-2 8-2 7-1
(B) The output could be 7-1 7-2 8-1 6-1
(C) The output could be 8-1 7-1 7-2 8-2
(D) The output could be 8-1 8-2 7-1 7-2
(A) The output could be 8-1 7-2 8-2 7-1
(B) The output could be 7-1 7-2 8-1 6-1
(C) The output could be 8-1 7-1 7-2 8-2
(D) The output could be 8-1 8-2 7-1 7-2
答案:登入後查看
統計: A(6), B(5), C(7), D(5), E(0) #2723520
統計: A(6), B(5), C(7), D(5), E(0) #2723520