In this assignment you will draw Java memory maps. Download this zip file and un-zip it. In the zip file there is a copy of this web page, which you can read in your browser, and a number of other files that you need for this assignment. This assignment is due Monday, September 28.
In the zip file is a document called > SimpleClassWithState obj1 > SimpleClassWithState obj2 > obj1 = new SimpleClassWithState() > obj2 = new SimpleClassWithState() > obj1.increaseState() > obj1.increaseState() > obj2.increaseState() > ClassVsObjectMethods.A() > ClassVsObjectMethods x > double pi = 3.14The image is a picture of Java's memory after executing the above ten statements. Your assignment is to draw similar memory maps of Java's memory after the execution of the code fragments given below.
Draw a map of Java's memory after the execution of the following code (in, for example, DrJava's interactions pane). Use these definitions for > Class1 ref1 = new Class1() > Class1 ref2 = new Class1() > Class2 ref3 = new Class2() > int x = 5 > ref1.methodC(x) > ref2.methodC( ref1.methodB() ) > Class1 ref4 = ref1 > ref4.methodC( ref4.methodA() ) > ref3.method1( Class2.method2() ) > ref1.methodC( Class1.methodA() )
Draw another map of Java's memory after the execution of the following code. Assume that Java's memory is empty when this code begins executing. Use the same definition for > Class1 obj1 = new Class1() > Class1 obj2 = new Class1() > Class1 obj3 = new Class1() > Class1 obj4 = new Class1() > obj4.methodA() > obj4 = obj3 > obj1.methodC( obj1.methodB() + obj4.methodA() ) > obj2.methodC(1000) > obj2 = obj4 > obj4.methodC( obj2.methodB() )
You need to draw your memory maps using some kind of drawing tool. Included in the zip file is a folder called
If you are familiar with some other drawing tool and would rather use it, feel free to. Just send me your drawings in either the svg, png, or pdf format. If you are not familiar with any drawing tools and would like to experiment with something more powerful than SVG-edit, try the free, open source, program Dia. Just download the following zip file, unzip it, and look for
Turn in a zip file called |