SHARE
TWEET

Untitled

advictoriam Jan 15th, 2019 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class SwapTester
  2. {
  3.    /**
  4.       Swaps two values
  5.       @param array an array of length 2 containing the
  6.       values to be swapped
  7.    */
  8.    public static void trueSwap(int[] array)
  9.    {
  10.       System.out.print(array[1]);
  11.       System.out.print(" ");
  12.       System.out.println(array[0]);
  13.    }
  14.  
  15.    public static void main(String[] args)
  16.    {
  17.       int[] xy = new int[2];
  18.       xy[0] = 3;
  19.       xy[1] = 4;
  20.       trueSwap(xy);
  21.       System.out.println("Expected: 4 3");
  22.    }
  23. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top