Advertisement
advictoriam

Untitled

Jan 15th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.49 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement