import java.io.*;

public class MutableInteger{
	private int myValue;

	public MutableInteger(int value)
	{
		this.myValue = value;
	}

	public void setValue(int value)
	{
		this.myValue = value;
	}

	public int getValue()
	{
		return myValue;
	}


	public static void main(String [] args)
	{
		//nums has no value yet it just exist  It is of size 3 only.
		MutableInteger [] nums = new MutableInteger[3];
		//Address of nums
		System.out.println("Printing the address of nums:");
		System.out.println(nums);
		System.out.println("Printing the values of nums[0], nums[1], nums[2]:");
		System.out.println(nums[0]);
		System.out.println(nums[1]);
		System.out.println(nums[2]);


		MutableInteger a = new MutableInteger(1);
		System.out.println("The address of a: ");
		System.out.println(a);
		System.out.println("Value of a is " + a.getValue());

		MutableInteger b = new MutableInteger(2);
		System.out.println("The address of b: ");
		System.out.println(b);
		System.out.println("Value of b is " + b.getValue());

		MutableInteger c = new MutableInteger(3);
		System.out.println("The address of c: ");
		System.out.println(c);
		System.out.println("Value of c is " + c.getValue());

		MutableInteger origA = a, origB = b, origC = c;

		System.out.println("Address of  origA " + origA);
		System.out.println("Address of  origB " + origB);
		System.out.println("Address of  origC " + origC);

		System.out.println("Printing the Values of origA, origB, origC:");
		System.out.println(origA.getValue());
		System.out.println(origB.getValue());
		System.out.println(origC.getValue());


		System.out.println("");
		System.out.println("");
		System.out.println("Now changing nums[0] = a");
		System.out.println("             nums[1] = c");
		System.out.println("             nums[2] = b\n");
		nums[0] = a;
		nums[1] = c;
		nums[2] = b;


		System.out.println("Printing the Address of nums:");
		System.out.println(nums);

		System.out.println("Printing the Address of nums 0 - 2:");
		System.out.println(nums[0]);
		System.out.println(nums[1]);
		System.out.println(nums[2]);

		System.out.println("Printing the Values of nums 0 - 2:");
		System.out.println(nums[0].getValue());
		System.out.println(nums[1].getValue());
		System.out.println(nums[2].getValue());

		System.out.println("Printing the Address of a,b,c:");
		System.out.println(a);
		System.out.println(b);
		System.out.println(c);

		System.out.println("Printing the Values of a,b,c:");
		System.out.println(a.getValue());
		System.out.println(b.getValue());
		System.out.println(c.getValue());

		System.out.println("Printing the Address of origA, origB, origC:");
		System.out.println(origA);
		System.out.println(origB);
		System.out.println(origC);

		System.out.println("Printing the Values of origA, origB, origC:");
		System.out.println(origA.getValue());
		System.out.println(origB.getValue());
		System.out.println(origC.getValue());


		System.out.println("");
		System.out.println("");
		System.out.println("Now changing:  a = nums[1]");
		a = nums[1];


		System.out.println("Printing the Address of nums:");
		System.out.println(nums);

		System.out.println("Printing the Address of nums 0 - 2:");
		System.out.println(nums[0]);
		System.out.println(nums[1]);
		System.out.println(nums[2]);

		System.out.println("Printing the Values of nums 0 - 2:");
		System.out.println(nums[0].getValue());
		System.out.println(nums[1].getValue());
		System.out.println(nums[2].getValue());

		System.out.println("Printing the Address of a,b,c:");
		System.out.println(a);
		System.out.println(b);
		System.out.println(c);

		System.out.println("Printing the Values of a,b,c:");
		System.out.println(a.getValue());
		System.out.println(b.getValue());
		System.out.println(c.getValue());

		System.out.println("Printing the Address of origA, origB, origC:");
		System.out.println(origA);
		System.out.println(origB);
		System.out.println(origC);

		System.out.println("Printing the Values of origA, origB, origC:");
		System.out.println(origA.getValue());
		System.out.println(origB.getValue());
		System.out.println(origC.getValue());







		System.out.println("");
		System.out.println("");
		System.out.println("Now Changing:  b = nums[0]");

		b = nums[0];

		System.out.println("Printing the Address of nums:");
		System.out.println(nums);

		System.out.println("Printing the Address of nums 0 - 2:");
		System.out.println(nums[0]);
		System.out.println(nums[1]);
		System.out.println(nums[2]);

		System.out.println("Printing the Values of nums 0 - 2:");
		System.out.println(nums[0].getValue());
		System.out.println(nums[1].getValue());
		System.out.println(nums[2].getValue());

		System.out.println("Printing the Address of a,b,c:");
		System.out.println(a);
		System.out.println(b);
		System.out.println(c);

		System.out.println("Printing the Values of a,b,c:");
		System.out.println(a.getValue());
		System.out.println(b.getValue());
		System.out.println(c.getValue());

		System.out.println("Printing the Address of origA, origB, origC:");
		System.out.println(origA);
		System.out.println(origB);
		System.out.println(origC);

		System.out.println("Printing the Values of origA, origB, origC:");
		System.out.println(origA.getValue());
		System.out.println(origB.getValue());
		System.out.println(origC.getValue());

		

		System.out.println("");
		System.out.println("");
		System.out.println("Now changing:  c = nums[2]");

		c = nums[2];

		System.out.println("Printing the Address of nums:");
		System.out.println(nums);

		System.out.println("Printing the Address of nums 0 - 2:");
		System.out.println(nums[0]);
		System.out.println(nums[1]);
		System.out.println(nums[2]);

		System.out.println("Printing the Values of nums 0 - 2:");
		System.out.println(nums[0].getValue());
		System.out.println(nums[1].getValue());
		System.out.println(nums[2].getValue());

		System.out.println("Printing the Address of a,b,c:");
		System.out.println(a);
		System.out.println(b);
		System.out.println(c);

		System.out.println("Printing the Values of a,b,c:");
		System.out.println(a.getValue());
		System.out.println(b.getValue());
		System.out.println(c.getValue());

		System.out.println("Printing the Address of origA, origB, origC:");
		System.out.println(origA);
		System.out.println(origB);
		System.out.println(origC);

		System.out.println("Printing the Values of origA, origB, origC:");
		System.out.println(origA.getValue());
		System.out.println(origB.getValue());
		System.out.println(origC.getValue());

		


		System.out.println("");
		System.out.println("");
		System.out.println("Now changing:  a.setValue(b.getValue());");
		a.setValue(b.getValue());

		System.out.println("Printing the Address of nums:");
		System.out.println(nums);

		System.out.println("Printing the Address of nums 0 - 2:");
		System.out.println(nums[0]);
		System.out.println(nums[1]);
		System.out.println(nums[2]);

		System.out.println("Printing the Values of nums 0 - 2:");
		System.out.println(nums[0].getValue());
		System.out.println(nums[1].getValue());
		System.out.println(nums[2].getValue());

		System.out.println("Printing the Address of a,b,c:");
		System.out.println(a);
		System.out.println(b);
		System.out.println(c);

		System.out.println("Printing the Values of a,b,c:");
		System.out.println(a.getValue());
		System.out.println(b.getValue());
		System.out.println(c.getValue());

		System.out.println("Printing the Address of origA, origB, origC:");
		System.out.println(origA);
		System.out.println(origB);
		System.out.println(origC);

		System.out.println("Printing the Values of origA, origB, origC:");
		System.out.println(origA.getValue());
		System.out.println(origB.getValue());
		System.out.println(origC.getValue());



		



		System.out.println("");
		System.out.println("");	
		System.out.println("Now changing:  b.setValue(c.getValue());");	
		b.setValue(c.getValue());

		System.out.println("Printing the Address of nums:");
		System.out.println(nums);

		System.out.println("Printing the Address of nums 0 - 2:");
		System.out.println(nums[0]);
		System.out.println(nums[1]);
		System.out.println(nums[2]);

		System.out.println("Printing the Values of nums 0 - 2:");
		System.out.println(nums[0].getValue());
		System.out.println(nums[1].getValue());
		System.out.println(nums[2].getValue());

		System.out.println("Printing the Address of a,b,c:");
		System.out.println(a);
		System.out.println(b);
		System.out.println(c);

		System.out.println("Printing the Values of a,b,c:");
		System.out.println(a.getValue());
		System.out.println(b.getValue());
		System.out.println(c.getValue());

		System.out.println("Printing the Address of origA, origB, origC:");
		System.out.println(origA);
		System.out.println(origB);
		System.out.println(origC);

		System.out.println("Printing the Values of origA, origB, origC:");
		System.out.println(origA.getValue());
		System.out.println(origB.getValue());
		System.out.println(origC.getValue());


		

		System.out.println("");
		System.out.println("");
		System.out.println("Now changing:  c.setValue(a.getValue());");
		c.setValue(a.getValue());


		System.out.println("Printing the Address of nums:");
		System.out.println(nums);

		System.out.println("Printing the Address of nums 0 - 2:");
		System.out.println(nums[0]);
		System.out.println(nums[1]);
		System.out.println(nums[2]);

		System.out.println("Printing the Values of nums 0 - 2:");
		System.out.println(nums[0].getValue());
		System.out.println(nums[1].getValue());
		System.out.println(nums[2].getValue());

		System.out.println("Printing the Address of a,b,c:");
		System.out.println(a);
		System.out.println(b);
		System.out.println(c);

		System.out.println("Printing the Values of a,b,c:");
		System.out.println(a.getValue());
		System.out.println(b.getValue());
		System.out.println(c.getValue());

		System.out.println("Printing the Address of origA, origB, origC:");
		System.out.println(origA);
		System.out.println(origB);
		System.out.println(origC);

		System.out.println("Printing the Values of origA, origB, origC:");
		System.out.println(origA.getValue());
		System.out.println(origB.getValue());
		System.out.println(origC.getValue());

		
		System.out.println("");
		System.out.println("");

		System.out.println("Printing the value of origA, origB, origC final");

		System.out.println(origA.getValue());
		System.out.println(origB.getValue());
		System.out.println(origC.getValue());

	}
}