阿摩線上測驗 登入

試題詳解

試卷:104年 - SCJP 201-244#99410 | 科目:OJCP(SCJP)

試卷資訊

試卷名稱:104年 - SCJP 201-244#99410

年份:104年

科目:OJCP(SCJP)

複選題
242. Given:
 public class NamedCounter{
 private final String name; 
private int count; 
public NamedCounter(String name){this.name = name;} 
public String getName(){return name;} 
public void increment(){count++;} 
public int getCount(){return count;}
 public void reset(){count = 0;}
 Which three changes should be made to adapt this class to be used safely by multiple threads? (Choose three.)
(A) declare reset() using the synchronized keyword
(B) declare getName() using the synchronized keyword
(C) declare getCount() using the synchronized keyword
(D) declare the constructor using the synchronized keyword
(E) declare increment() using the synchronized keyword
正確答案:登入後查看