Dear all,

Scope resoultion operator is used to call the properties or methods of the class.

Properties :
===========
Variables
Constants

Why scope resoultion operator cannot be used for non-static variables .


Can any one help me out .

Thank you,

With Regards,
Prem

from what I just read online, there is no scope resolution operator in java. google it, and you'll find your answer.

As bibiki pointed out, there is no scope resolution operator in java. If you are not in the wrong section, and you are actually talking about java, Then the reason you cannot call not-static methods/variables using

Object.variable1 ..etc

Is because non-static variables/methods are Instance variables/methods. Meaning, they can only be accessed when an Instance(Object) is created.
i.e.

Object obj = new Object();
obj.variable1;

static variables, are Class variables, meaning, you do not need to create an Instance of the class to access them. You just explicitly use the name of the class and a .
i.e.

ClassName.variable2;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.