// Original author: David I. Schwartz, dis@cs.cornell.edu // Modified slightly by Kiri Wagstaff, wkiri@cs.cornell.edu // Date: June 27, 2001 // This program swaps two values (do you believe it?) public class Swap { public static void main(String[] args) { // Initialize variables: int value1, value2; value1 = 10; value2 = 20; // Draw the program state. // Output current values: System.out.println("Value1: " + value1); System.out.println("Value2: " + value2); // Swap values: System.out.println("Now swapping....\n"); // What is \n? int tmp; tmp = value1; value1 = value2; value2 = tmp; // Output current values: System.out.println("Value1: " + value1); System.out.println("Value2: " + value2); } }