ArrayList tArrayList = new ArrayList();
i = 27; tArrayList.Add(i);an object is automatically created.
Point tPoint = new Point(100, 200); tArrayList.Add(tPoint);
If instead we use a struct type, boxing takes place:
SPoint tSPoint = new SPoint(300, 400); tArrayList.Add(tSPoint);
int i = 27; Integer tInteger = new Integer(i); tArrayList.Add(tInteger);
This means the value of the object is copied into the variable:
int j = (int) tArrayList[0]; Point tGotPoint = (Point) tArrayList[1]; SPoint tGotSPoint = (SPoint) tArrayList[2];