This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
was called with foo(7) and foo is popped at the second println and resumed, it will print: Foo: 4. ==================
where it states that any changes made the integer argument passed into the method will not be restored if the method's stack frame is popped. I understand that. What I DON'T understand, is why this is.
If the method argument "int x" is stored in the leaf method's stack frame, and that stack frame is popped with the popframes method, then surely this method argument would also be popped off the stack too, and original value stored in the caller method would be passed back in when the method is re-invoked? I mean, the int is a primitive, and so is passed-by-value into the method.