Question: 3.3 List or draw out the memory contents for the seven slides (23-29) with StaticExample or DynamicExampleXXX and ObjX classes. You can either draw a







3.3 List or draw out the memory contents for the seven slides (23-29) with StaticExample or DynamicExampleXXX and ObjX classes. You can either draw a picture with boxes and arrows for pointers (you do not need to show addresses), or you can clearly list out what memory is stored in each region (Stack, Heap, or Globals). Assume the garbage collector has not yet run.
Static Object Memory Stack / A simple static object. Note: all members (data and methods) // are declared with the "static" keyword. class objx f static int i; static void print ) Heap System.out.println ("i-" +i)i // All static members / The class that has "main" public class StaticExample f Globals public static void main (String[] argv) /I Refer to a member of objX using the class name ObjX. 5; // Call a method using the class name and dot-operator. objx.print); Static Object Memory Stack / A simple static object. Note: all members (data and methods) // are declared with the "static" keyword. class objx f static int i; static void print ) Heap System.out.println ("i-" +i)i // All static members / The class that has "main" public class StaticExample f Globals public static void main (String[] argv) /I Refer to a member of objX using the class name ObjX. 5; // Call a method using the class name and dot-operator. objx.print)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
