CPSC 211, Sec 201-203: Quiz 2
Jan 28, 2004

Name:________________________________________

Suppose you have the following class declared:

public class ListNode {
   int data;
   ListNode link;
}
Consider the following code fragment:
...
ListNode n1 = new ListNode();
n1.data = 14;
n1.link = null;
n1.link = new ListNode();
ListNode n2 = n1.link;
n2.data = 8
n2.link = null;
...
Draw the memory diagram (what's on the stack and what's on the heap) after the code fragment executes.