/* CSC 16 homework exercise, due Tuesday 9/27 This assignment is intended to solidify your understanding of pointers and heap/stack usage by tracing through an experiment. First, without running the program, determine what you think each function does, and what the values of a, A.x and B.x (in main) are after each function is called. Then run the program and see if you're right. For each function call, DRAW a memory allocation diagram like the ones in class to indicate what is happening at the point right before the function call exits. The diagram must clarify 1. the contents of the stack 2. the contents of the heap 3. where all the pointers are pointing. Please be neat. */ class bigobject { public int x; public bigobject(int y) {x=y;} } public class hw1 { public static void f1(bigobject A, int a) { A.x = A.x + 4; a = a + 4; } public static void f2(bigobject A) { bigobject B = new bigobject(3); A = B; } public static void f3(bigobject A, bigobject B) { A = B; A.x = A.x + 4; } public static void main(String[] args) { bigobject A = new bigobject(1); bigobject B = new bigobject(2); int b = 3; f1(A,b); System.out.println("b is "+b+", A.x is "+A.x+" and B.x is "+B.x); f2(A); System.out.println("b is "+b+", A.x is "+A.x+" and B.x is "+B.x); f3(A,B); System.out.println("b is "+b+", A.x is "+A.x+" and B.x is "+B.x); } // main }