Functions (ahhh Methods!)
For example:
int my_func(String s) {
return s.length();
}
The length method returns the number of characters in the
string
s is actually a reference to the calling routine’s string object
void is available in Java as it is in C++ to return nothing
from the function
While object references are placed on the stack when a
function is called – the objects to which they refer are not
(never). There is no support of a “pass by value” concept
with objects of a class.
Therefore, we will never perform a deep copy as part of a
function call