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
第1题:
类 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; } }第2题:
类 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; } }第3题:
【单选题】类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;} }第4题:
【单选题】类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;} }第5题:
类 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;