Which of the following is accessible by instance methods ?(a) Only instance variables (b) Only class variables(c) Both instance variables and class variables (d) All of the above
Answers
the answer for your question is both instance and class variables
"Option: c ,""Both instance and class variables""
Instance methods are those methods which are defined as non static. For instance methods, both class variables and instance variables are accessible. So, the correct choice of answer for the given question from the list of possible answers is (c) Both instance variables and class variables.
Class members (which can be variables or methods) are those members which are declared using static keyword whereas instance members are not defined using the static keyword. So, class variables are those variables which are declared using the static keyword while instance methods are the methods which are not declared using static keyword.
"