Accessing A Function

The methods are the main building blocks of Java programs. A Java method is a collection of statements that is grouped together to perform an operation. The methods allow us to reuse the portion of code. When a method is defined at any place in the program, then it is called method definition. A simple Java method requires a minimum of three items: visibility - public, private, protected, Return Type - void, int, double, (etc.) and name of the method. A method is called (invoked or executed) by providing the method name along with the argument list enclosed in the parenthesis.

A parameter is a value that is passed to a method so that the method can use that value in its processing. The parameters are of two types: Actual parameter and formal parameters. The parameters that appear in function call statement are called actual parameters. The parameters that appear in method definition are called formal parameters. There are two ways for passing argument to the method: Pass By Value or Call By Value and Pass By Reference or Call By Reference.

To Access the full content, Please Purchase