网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)

publicclassNamedCounter{privatefinalStringname;privateintcount;publicNamedCounter(Stringname){this.name=name;}publicStringgetName(){returnname;}publicvoidincrement(){coount++;}publicintgetCount(){returncount;}publicvoidreset(){count=0;}}Whichthreechangesshouldbemadetoadaptthisclasstobeusedsafelybymultiplethreads?()

A.declarereset()usingthesynchronizedkeyword

B.declaregetName()usingthesynchronizedkeyword

C.declaregetCount()usingthesynchronizedkeyword

D.declaretheconstructorusingthesynchronizedkeyword

E.declareincrement()usingthesynchronizedkeyword


参考答案

更多 “ publicclassNamedCounter{privatefinalStringname;privateintcount;publicNamedCounter(Stringname){this.name=name;}publicStringgetName(){returnname;}publicvoidincrement(){coount++;}publicintgetCount(){returncount;}publicvoidreset(){count=0;}}Whichthreechangesshouldbemadetoadaptthisclasstobeusedsafelybymultiplethreads?()A.declarereset()usingthesynchronizedkeywordB.declaregetName()usingthesynchronizedkeywordC.declaregetCount()usingthesynchronizedkeywordD.declaretheconstructorusingthesynchronizedkeywordE.declareincrement()usingthesynchronizedkeyword ” 相关考题
考题 类MyClass中,下列哪条语句定义了一个只读的属性Count? A.privateintCount;B.privateintcount;publicintCount{get{returncount;}}C.publicreadonlyintCount;D.publicreadonlyintCount{get{returncount;}set{count=value;}}

考题 有关类Demo,哪句描述是正确的( )?public class Demo extends Base{private int count;public Demo(){ System.out.println("A Demo object has been created");} protected void addOne() {count++; }} A.当创建一个Demo类的实例对象时,count的值为0。B.当创建一个Demo类的实例对象时,count的值是不确定的。C.超类对象中可以包含改变count 值的方法。D.Demo的子类对象可以访问count。

考题 类 MyClass 中,下列哪条语句定义了一个只读的属性 Count?A.private int Count;###SXB###B.private int count; public int Count { get{ return count; } }###SXB###C.public readonly int Count;###SXB###D.public readonly int Count { get{ return count; } set{ count = value; } }

考题 类 MyClass 中,下列哪条语句定义了一个只读的属性 CountA.private int Count;#B.private int count; public int Count { get{ return count; } }#C.public readonly int Count;#D.public readonly int Count { get { return count; } Set { count = value; } }

考题 类 MyClass 中,下列哪条语句定义了一个只读的属性 CountA.private int Count;#B.private int count; public int Count{ get{ return count; } }#C.public readonly int Count;#D.public readonly int Count{ get{ return count; } set{ count = value; } }

考题 【单选题】类MyClass 中,下列哪条语句定义了一个只读的属性Count?(2 分)A.private int Count;#B.private int count; public int Count{ get{return count;} }#C.public readonly int Count;#D.public readonly int Count { get{ return count;} set{count = value;} }

考题 类 MyClass 中,下列哪条语句定义了一个只读的属性 Count?A.private int Count;#B.private int count; public int Count { get{ return count; } }#C.public readonly int Count;#D.public readonly int Count { get{ return count; } set{ count = value; } }

考题 类 MyClass 中,下列哪条语句定义了一个只读的属性 Count?A.private int Count;#B.public readonly int Count { get { return count; } set { count = value; } }#C.private int count; public int Count { get { return count; } }#D.public readonly int Count;

考题 【单选题】类MyClass 中,下列哪条语句定义了一个只读的属性Count?(3 分)A.private int Count;#B.private int count; public int Count{ get{return count;} }#C.public readonly int Count;#D.public readonly int Count { get{ return count;} set{count = value;} }