Phase V
Methods
Giving work a name, and the stack that makes it possible.
Move work out of main and into named, testable methods. Trace arguments into parameters, returned values into expressions, and active calls on the stack. Then use the same model to understand recursion and overload resolution.
When you finish this phase you can
- Define, call, and test methods with parameters, void returns, and value returns
- Explain argument evaluation, parameter scope, and all-path return checking
- Apply Java's pass-by-value rule to primitives, arrays, and object references
- Draw stack frames for nested and recursive calls
- Write recursion with a reachable base case and progress toward it
- Predict overload selection across strict, loose, and variable-arity invocation
- Explain why the return type is not part of a method signature