Question: Given: rofuoroo public class Transaction ( private static int counter = 0 ; private int transactionID; private String customerName; public void executeTransaction ( String customerName

Given: rofuoroo public class Transaction ( private static int counter =0; private int transactionID; private String customerName; public void executeTransaction (String customerName transactionID = counter; counter++; 10. this.custome rName customerName; 11.12.13.) tHow do you make this code thread safe?Change line1to public class synchronized Transaction( Change line 7 to synchronized (this)( and line 11 to ) Change line 2 to private synchronized static int counter =0; Change line 6 to public synchronized (this) executeTransaction (String customerName)(

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!