Question: Q 1 . A hammer tool can only be used by one technician at a time to perform hitting. Accordingly, you have developed a Hammer

Q1. A hammer tool can only be used by one technician at a time to perform hitting. Accordingly, you have developed a Hammer class with a hit method. Objects of class Hammer are used to simulate different hammers, while threads are created to simulate users. Which situation needs to add the synchronized keyword to the hit method?
A. Two users use one hammer.
B. Two users use two hammers with one for each.
C. One user uses one hammer.
D. One user uses two hammers.
E. All of the listed answers

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!