This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: 1 1 CS100J 8 March 2007 Executing method calls. Testing Drawing frames for method calls: read pp. 93-94 Testing: read chapter 14, pp. 385–401 2 Executing method calls, pp 93-94 Understanding this not only prepares you for prelim 2, it helps you understand how recursion can work and how a method determines what variables mean. method name: program counter parameter 1 parameter n local variable m local variable 1 frame for a call number of statement to execute next Execution of method call 1. Draw a frame for the call. 2. Assignment arg values to the pars 3. Execute method body 4. Erase frame, and, for a function, return value of the return expression. In step 3, look in frame for variables/methods. 3 Executing method calls, pp 93-94. The scope box method name: program counter scope box parameter 1 parameter n local variable m local variable 1 static method: name of class. non-static method: name of object in which the called mehod resides. Execution of method call 1. Draw a frame for the call....
View Full Document
- Spring '07