Member variable and instance variable are terms originating outside of the Java culture. In Java, we have fields - static and non-static fields. We also have members which are either fields, methods or constructors.
The term "member variable" and "instance variable" are generally used interchangeably to mean the same thing as "non-static field".
Chuck
Static data belongs to a class, not a particular instance of that class. Every instance of that class shares the static variables. Changes to non-final statics affect all instances.
Each instance can have its own variables. These are NEVER static. Changes to instance variables affect only that instance and no others.
You'll have to get used to different terminology. C++ and other O-O languages sometimes have terms that mingle with Java's. The important thing is the idea. - MOD
> Instance variable are the variables associated with
> the particular instance of class (thus static is not
> instance variable) where as member are simple
> attributes of the class.....
>
> i hope i m clear enough....
>
> kk
I assume this is what you mean:MyClass myObj = new MyClass();
myObj.myField = 0;
// myObj is an instance variable (instance of class MyClass).
// myField is a member variable (member of a MyClass object).
There is no concept of member-variable in Java. There are three kinds of class members, constructors, methods and fields.
That said, yes, you could say the a class variable is also a member variable even though it is shared among all instances of the class within the scope of the classloader.
Chuck