Total noobie question here.
I'm just learning Java, and studying passing arguments to functions. I created this basic example, and it is doing what I expect, but I want to be sure I am understanding the "signal path" correctly:
public void run() {
int value = 4;
println(" the value is "+ add(value));
}
private int add(int n) {
int result = 4;
result = n + result;
return result;
}
}
Am I correct to say that:
1) the int value
is being passed from add(value)
to the private method and so then int n = 4
2) then the result = n + return.
(8)
3) then the return result
passes back to the public method and takes the place of add(value)
.
Is my thinking correct? Thanks! Joel