nerdexam
Oracle

1Z0-851 · Question #246

1Z0-851 Question #246: Real Exam Question with Answer & Explanation

Sign in or unlock 1Z0-851 to reveal the answer and full explanation for question #246. The question stem and answer options stay visible for context.

Question

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.)

Options

  • Adeclare reset() using the synchronized keyword
  • Bdeclare getName() using the synchronized keyword
  • Cdeclare getCount() using the synchronized keyword
  • Ddeclare the constructor using the synchronized keyword
  • Edeclare increment() using the synchronized keyword

Unlock 1Z0-851 to see the answer

You've previewed enough free 1Z0-851 questions. Unlock 1Z0-851 for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.

Full 1Z0-851 Practice