A variable whose scope is restricted to the method where it was declared is known as a(n)


A variable whose scope is restricted to the method where it was declared is known as a(n)


a) parameter

b) global variable

c) local variable

d) public instance data

e) private instance data

Answer: c. Explanation: Local variables are those that are “local” to the method in which they have been declared, that is, they are accessible only inside that method. Global variables are those that are accessible from anywhere, while parameters are the variables passed into a method. Instance data can be thought of as global variables for an entire

object.