nerdexam
Oracle

1Z0-804 · Question #82

Which class(es) safely protects the doIt () method from concurrent thread access?

The correct answer is A. Option A D. Option D. only A und D possible It should be pointed out that: public void blah() { synchronized (this) { is semantically equivalent to: public synchronized void blah() { Incorrect answer: B: A constructor cannot be synchronized. () Object cannot be resolved to a type C: in static…

Concurrency

Question

Which class(es) safely protects the doIt () method from concurrent thread access?

Options

  • AOption A
  • BOption B
  • COption C
  • DOption D

How the community answered

(21 responses)
  • A
    81% (17)
  • B
    5% (1)
  • C
    14% (3)

Explanation

only A und D possible It should be pointed out that: public void blah() { synchronized (this) { is semantically equivalent to: public synchronized void blah() { Incorrect answer: B: A constructor cannot be synchronized. () Object cannot be resolved to a type C: in static context (static void main !) no reference to this possible

Topics

#synchronized method#thread safety#concurrent access

Community Discussion

No community discussion yet for this question.

Full 1Z0-804 Practice