Read the passage given below | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Read the passage given below

"Each instance variable is contained in an object. It can be accessed only if you have a reference to that object. No such reference is available to a static method." I dont get the line -if u have a reference to that object Please explain it.

21st Jul 2020, 9:25 AM
stephen haokip
stephen haokip - avatar
2 Answers
+ 1
if this is about class variables. it means that variable that are not declared static can be accessed by using an object(instance) of the class. ie: object.var static variables can be accessed without an object ie: ClassName.var i'm not sure about the context of your post, so I could be off topic.
21st Jul 2020, 10:03 AM
Bahhaⵣ
Bahhaⵣ - avatar
0
Would it probably make a better sense if we replace "have a reference to" by "have access to"?
21st Jul 2020, 11:12 AM
Ipang