

public class MainDriver {
	
	public static void main(String[] args) {

		Pair<Integer, Integer> pair = new PairImpl<Integer, Integer>(1,2);
		System.out.println("Sum: " + 
				(pair.getElement1() + 
				pair.getElement2())); 
		
		Pair<String, String> pair2 = new PairImpl<String, String>("Hello", "World");
		System.out.println("Sum: " +
				(pair2.getElement1() + " " +
				pair2.getElement2())); 
				
		Pair<Integer, String> pair3 = new PairImpl<Integer, String>(1, "A");	
		System.out.println("Sum: " + pair3.getElement1() + pair3.getElement2());

		// print(pair3);      // pair<Object, Object> is not a super-class of
		                      // pair<String, String> or pair<String, Integer>
		
		// 
		// Pair<Object, Object> pair4 = new Pair<Integer, String>(0, "A");
		//
	}

	// cannot use Object as a super-class so that you can send it any type of object
	public static void print(Pair<Object, Object> pair) {
		System.out.println("(" + pair.getElement1() + ", " + pair.getElement2() + ")");
		pair.setElement1(1.04);
		pair.setElement2(4.5);
		// because then, if you could use Object for both arguments, then inside 
		// this method, you could do weird things like calling setElement and 
		// sending it something other than what it's supposed to be because this 
		// method doesn't know that the pair sent in contained an Integer and a 
		// String, it just knows that the first argument is an Object and the second 
		// argument is an Object
		
	}

}



