📚 Practice Mode
Java Programming Quiz
Learn at your own pace with hints and detailed explanations
1 / 20
Multiple Answers
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.)
- declare reset() using the synchronized keyword
- declare getName() using the synchronized keyword
- declare getCount() using the synchronized keyword
- declare the constructor using the synchronized keyword
- declare increment() using the synchronized keyword