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.
2 Antworten
+ 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.
0
Would it probably make a better sense if we replace "have a reference to" by "have access to"?