Lab 14: Memory Diagram with Objects

In this lab, we will enhance our understanding of memory diagrams with objects. Work in pairs if you wish.

Problem 1

Using UseAccount3.java from lecture 12, Draw the memory diagram for the entire life time of the program, which is defined by the main method in UseAccount3.java. It uses a couple of other Java classes: Customer.java and Account3.java. Note that we are not drawing a memory diagram for a particular snapshot. So, you will start with an empty page and end up with an empty page [and, yes, use a pencil for this exercise!] Along the way, you will be drawing and erasing stack frames on the stack and objects in the heap.

Problem 2

Using UseStudent.java from lecture 13, draw the memory diagram for the entire life time of the program, which is defined by the main method in UseStudent.java. It uses a couple of other Java classes: Student.java and ArrayTools.java. Here, again you will start with an empty page and end up with an empty page.

When you are done,

When you are done with these, feel free to leave the meeting.