Answer: Option A) True
Explanation:
Let's take an example:
public static int min (int a, int b)
{
if (a <= b)
return a;
else
return b;
}
We divide method into two parts: header and body.
- The method header comprises the access modifiers (public static), return type (int), method name (min), and parameters (int a, int b); if this method threw any exceptions, they would appear next.
- The method body is a block-statement that immediately follows the method header. The parameter names are like variable names; in fact, we often call them parameter variables to make this similarity explicit.
When a method is called, its parameter variables are always initialized by matching arguments first. Then, the method body executes, using these values to compute and return its result; it can also any local variables declard in the block to help in its computation.
If we wrote the statement
System.out.println( Math.min(3,5) );
it would display 3. If we had declared int x = 3, y = 8; and wrote the statement
System.out.println(Math.min (3*x+5,y) );
it would display 8
If we wrote the statement
System.out.println( Math.min(3,5) );
it would display 3. If we had declared int x = 3, y = 8; and wrote the statement
System.out.println(Math.min (3*x+5,y) );
it would display 8
Generally, We call a method by writing its name, followed in parentheses by its arguments (one for each parameter in the method's header) As in the header (where parameters are separated by commas), arguments are are separated by commas as well. When we call a method, Java first evaluates each argument (each can be a simple or complicated expression) and transmits or passes it to its matching parameter; this just means that Java uses each argument's value to initialize it matching parameter in the method. It is equivalent to writing first-parameter = first-argument, then second-parameter = second-argument, etc.
Thus, when calling Math.max(3*x+5,y) above, the first parameter (a) is initialized by the value 14 (3*x+5: the equivalent of a = 3*x+5). Likewise, the second parameter (b) is initialized by the value 8 (y: the equivalent of b = y). Then, Java executes the body of the method, which typically performs some computation using these initialized parameters. It finally returns a result.