Method calls, the details
|
|||||
|
|
Class scope (static )
|
Application process |
Instance scope | Object lifetime: new
(...) until being garbage collected.
|
Method scope | Method invocation until return .
|
- Heap memory
-
-
Allocation of class or array instances:
new String()
new float[200]
-
De-allocation subject to garbage collection.
-
- Execution stack
-
-
One instance per process thread.
-
Hosting variables (values or references)
-
Method | Description | Precondition | Access type |
---|---|---|---|
push(...) |
Add object on top |
- |
Modify |
pop() |
Read + remove topmost object |
Stack not empty |
Modify |
top() |
Read topmost object |
Stack not empty |
Read only |
empty() |
|
- |
Read only |
peek()
method
having exactly the «original» stack top()
method's semantic.
❶ |
Three call stack frames corresponding to
|
❷ |
Local variables corresponding to selected stack frame. TipIn the above example you may select stack frame “circleArea” showing its local variables while leaving your debugger resting at line 3. |