Students understanding or misunderstanding about scope impacts what they believe the actual arguments have to be.
When students don’t have a good grasp on scope, they believe (perhaps unconsciously) that the actual arguments have to match the formal parameters.
Definitions:
Actual arguments: the values passed to the method.
Formal parameters: the names of the variables specified in the method header.
Students often don’t realize that these two things are different.
Consider the following Java code, Example A.
Students might not realize the difference between the two variables named x.
|
Now, consider this example, Example B.
Students may have an easier time seeing that:
x is the actual argument to the method foo, and
y is the formal parameter to the method foo.
|