/** This class is provided for you but is not thread-safe. You must modify it to be thread-safe and explain answers to the questions in the files for this lab */ public class SwapUm { private int x; private int y; /** Initially, x and y are 0 and 1, respectively. */ public SwapUm() { x = 0; y = 1; } /** The swap method described in class, with a pause between swaps. Questions you must answer:
  1. What happens if you change or eliminate the sleep time?
  2. How can you modify the methods of this class to be thread-safe (you must leave the sleep in!)
*/ public void swap() { int temp = x; x = y; Lab3.sleep(100); y = temp; } /** Returns the usm of x and y */ public int getSum() { return x + y; } }