Question

In object-oriented programming, what is the scope of an instance variable?

A It can be accessed from any method within the same class. Correct Answer Incorrect Answer
B It can be accessed from any instance of the same class. Correct Answer Incorrect Answer
C It can only be accessed from within the constructor of the class. Correct Answer Incorrect Answer
D It can only be accessed from static methods of the class. Correct Answer Incorrect Answer

Solution

It can be accessed from any instance of the same class.

Practice Next

Relevant for Exams:

×
×