Java Reference
In-Depth Information
static int x=0;
F
x++;
main
x++;
F();
G();
F();
Local memory
(function call stack)
Global memory
(static variables, referenced structures)
static int x=1;
G
-x;
-x;
main
F();
G();
F();
Local memory
(function call stack)
Global memory
(static variables, referenced structures)
static int x=0;
F
x++;
x++;
main
F();
G();
F();
Local memory
(function call stack)
Global memory
(static variables, referenced structures)
Figure 3.2 Visualizing the local function call stack and the global memory
for program FunctionSideEffect.java
overloaded provided its argument types differ from the original function. This is
useful in a number of situations where we would like to have a function perform
the same “function” on different kinds of typed arguments, as illustrated by
the following program:
Program 3.9 Function signatures and overloading
class PlusOne {
 
Search WWH ::




Custom Search