Question: public class TestSum { public static void main(String[] args){ int a = 10; int b = 20; int total = calcSum(a, b); System.out.println(the total is

public class TestSum {

public static void main(String[] args){

int a = 10;

int b = 20;

int total = calcSum(a, b);

System.out.println("the total is " + total);

}

public static int calcSum(int x, int y){

int result;

result = x + y; return result;

}

}

, then answer the questions below :

What are the names of the formal parameters for method calcSum?

What are the names of the actual parameters for method calcSum?

Do you find formal parameters in method definition or in method invocation?

Do you find actual parameters in method definition or in method invocation?

What is the method signature of method calcSum?

What is the method header of method calcSum?

Does the method signature include the return type?

Does the method header include the return type?

If the method signature in the invocation does not match the method signature in the definition, will the program compile?

Can the formal parameters have the same name as the actual parameters?

In the above code, what is the first method pushed into the stack, main method or calcSum method?

In the above code, what is the first method pop out of the stack, main method or calcSum method?

Are the values passed from actual parameters to formal parameters, or from formal parameters to actual parameters?

When the value of primitive type variables is passed, will the change of the formal parameters affect the actual parameters? Hint: pass-by-value is a one-way passing.

What is the definition of pass-by-value?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!