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 ; private int transactionID; private String customerName; public void executeTransaction String customerName transactionID counter; counter; this.custome rName customerName; tHow do you make this code thread safe?Change lineto public class synchronized Transaction Change line to synchronized this and line to Change line to private synchronized static int counter ; Change line 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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
