Oracle
1Z0-804 · Question #77
Which two demonstrate the valid usage of the keyword synchronized?
The correct answer is C. class ThreadSafe { D. enum ThreadSafe {. The Java programming language provides two basic synchronization idioms: synchronized methods and synchronized statements. To make a method synchronized, simply add the synchronized keyword to its declaration.
Concurrency
Question
Which two demonstrate the valid usage of the keyword synchronized?
Options
- Ainterface ThreadSafe {
- Babstract class ThreadSafe {
- Cclass ThreadSafe {
- Denum ThreadSafe {
How the community answered
(30 responses)- A17% (5)
- B10% (3)
- C73% (22)
Explanation
The Java programming language provides two basic synchronization idioms: synchronized methods and synchronized statements. To make a method synchronized, simply add the synchronized keyword to its declaration.
Topics
#synchronized keyword#thread safety#synchronization
Community Discussion
No community discussion yet for this question.