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…
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)- A81% (17)
- B5% (1)
- C14% (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
Community Discussion
No community discussion yet for this question.