Method call
There are three ways to call a method:
-Using a method name by itself to call another
method of the same class.
-Using a variable that contains a reference to an
object, followed by a dot (.) and the method name
to call a method of the referenced object.
-Using the class name and a dot (.) to call a static
method of a class.
| A method can either return results(value) or a
control to the collar
| Two ways to pass arguments in method calls in many
programming languages are pass-by-value and pass
by-reference (also called call by-value and call-by
reference).
| When an argument is passed by value, a copy of the
argument’s value is passed to the called method.
| The called method works exclusively with the copy.
| When an argument is passed by reference, the called
method can access the argument’s value in the caller
directly and modify that data, if necessary.
| In java all arguments are passed by value-copy of
primitive value or copy of reference to object.

0 Comments