Question: using Java, show this box / pointer diagram (practice exam) Fill in the box and pointer diagram to show the variable L and the objects
Fill in the box and pointer diagram to show the variable L and the objects and their contents resulting from a call to create() when program execution reaches the point labeled HERE, using the empty boxes provided. Some objects may be unreachable from any named pointer variable (may be "garbage to use the technical term); show them anyway. The double boxes represent array objects. You need not use all the boxes. static Object[] M(Object left, Object right) { return new Object () { left, right }; static Object ( A(Object obj) { return (Object[]) obj; static void create() { Object[] L; L = M(null, M(null, M(null, null)); L = M(A(L) (1), L); A (A(L) [1])[0] = A (A(L) [O]) [1]; L = A(A(L)[0]); // HERE Fill in the box and pointer diagram to show the variable L and the objects and their contents resulting from a call to create() when program execution reaches the point labeled HERE, using the empty boxes provided. Some objects may be unreachable from any named pointer variable (may be "garbage to use the technical term); show them anyway. The double boxes represent array objects. You need not use all the boxes. static Object[] M(Object left, Object right) { return new Object () { left, right }; static Object ( A(Object obj) { return (Object[]) obj; static void create() { Object[] L; L = M(null, M(null, M(null, null)); L = M(A(L) (1), L); A (A(L) [1])[0] = A (A(L) [O]) [1]; L = A(A(L)[0]); // HERE
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
