70 likes | 131 Views
Data. j. 100. ?. ?. ?. i. ?. i. ?. d. method stack. Animation of CallerAndCallee (1/7). inc1(2 * 50);. System.out.println( ++i );. System.out.println(++i);. 101. 100. 101. callee: 101. Data. j. 100. i. ?. ?. ?. ?. i. ?. ?. ?. i. ?. d. method stack.
E N D
Data j 100 ? ? ? i ? i ? d method stack Animation of CallerAndCallee (1/7) inc1(2 * 50); System.out.println(++i); System.out.println(++i); 101 100 101 callee: 101
Data j 100 i ? ? ? ? i ? ? ? i ? d method stack Animation of CallerAndCallee (2/7) inc1(i = 100); inc1(i = 100); System.out.println(++i); System.out.println(++i); System.out.println(i); 101 101 100 100 callee: 101 caller: 100 100
Data j 100 ? ? ? ? i ? ? ? i ? d method stack i Animation of CallerAndCallee (3/7) i = inc3(i = 100); i = inc3(i = 100); i = inc3(i = 100); System.out.println(++i); System.out.println(++i); return i; System.out.println(i); 101 100 101 101 callee: 101 caller: 101 101 100
Data j 100 ? Data i 100 ? ? ? d ? ? d ? i ? d method stack Animation of CallerAndCallee (4/7) inc4(d = new Data()); inc4(d = new Data()); inc4(d = new Data()); System.out.println(++d.i); System.out.println(++d.i); System.out.println(d.i); 101 101 callee: 101 caller: 101 101
Data d j 100 ? Data Data i i 100 100 ? ? ? d ? ? ? i ? d method stack Animation of CallerAndCallee (5/7) inc5(d = new Data()); inc5(d = new Data()); inc5(d = new Data()); d = new Data(); d = new Data(); System.out.println(++d.i); System.out.println(++d.i); garbage System.out.println(d.i); 101 101 100 callee: 101 caller: 100
Data d j 100 ? Data Data i i 100 100 ? ? ? d ? ? ? i ? d method stack Animation of CallerAndCallee (6/7) d = inc6(d = new Data()); d = inc6(d = new Data()); d = inc6(d = new Data()); d = inc6(d = new Data()); d = new Data(); d = new Data(); System.out.println(++d.i); System.out.println(++d.i); return d; System.out.println(d.i); 101 101 101 callee: 101 caller: 101
Data j 100 ? ? ? ? ? ? i ? d method stack Animation of CallerAndCallee (7/7) inc7(); System.out.println(++Data.j); System.out.println(++Data.j); 101 System.out.println(Data.j); 101 101 callee: 101 caller: 101