Advertisements
Advertisements
Question
Which of the following data is a separate field for all the objects of a class?
Options
Local variable
Class variable
Instance variable
Primitive variable
MCQ
Solution
Instance variable
Explanation:
An instance variable is a non-static variable specified within a class. Each class object (instance) receives its own distinct copy of the instance variable, and the values of instance variables can differ for each class object.
shaalaa.com
Is there an error in this question or solution?