Card 42 / 76: What type of variable would be used to store the state of an object?
A)
Local variable
B)
Method parameter
C)
Instance variable
D)
Object variable
Answer:
C) Instance variable
Previous Card | ← Previous Card Button |
Next Card | → Next Card Button |
Flip Card | Space-Bar |
A, B, and D are incorrect.
A is incorrect because a local variable is used for temporary items and stays in scope only until the block of code it is declared in is exited.
B is incorrect because method parameters are the variables passed to a method as arguments. They are in scope only for that method.
D is incorrect because the object variable does not exist.
|