Java: Is "reference variable of a class" same as "an object of that class"?

In context to Java programming,

Is "reference variable of a class" same as "an object of that class"?

Also for a code like

class Sample
{
int a, b;
public static void main(String arg[])
{
int c;
// other statements
}
}

Among the variables a,b, c which are the class variables.

Is there a difference between variable a/b and variable c as far as their scope is concerned?

Replies

  • Anoop Kumar
    Anoop Kumar
    I assume you like to know the difference between, Instance variable and local variable.

    There is certainly scope difference between variable "a" and "c".
    "a/b" are class/instance variables .
    "c" is a local variable defined inside the method.
    scope of "a/b" is associated to instance of class, object, just like method, in your program main() method.
    Better go through full tutorial of varial type and do some practice.
    Java - Variable Types

    You question is confusing, what exactly you are looking far?

You are reading an archived discussion.

Related Posts

As more of your stuff at home gets smarter by being a part of Internet of Things (IoT), you will soon need a device that helps you control all of...
A new Android malware has been discovered by Hemidal Security in Denmark that can gain complete control over your smartphone. The malware titled Mazar was discovered by the security firm...
hi iam madhu I have a idea why don't we use permanent battery for mobile why we are using charging all the time why con't we put a solar panels...
The Swedish Clean Air Technology company, Blueair has taken a leap into the lucrative Indian market with their flagship products, namely the Blueair Sense+ air purifier and the Blueair Aware...
While the whole country is going gaga over the dirt cheap Freedom 251, Swipe has quietly launched its new smartphone, the Swipe Konnect 5.1 exclusively on Snapdeal. The Swipe Konnect...