| Author |
difference between instance variable and simple variable
|
Tomendra Singh
Ranch Hand
Joined: Jun 28, 2008
Posts: 47
|
|
hi all, i am little bit confused that difference between instance variable and simple variable. if it is then please give me some examples. thank you.
|
Strength Is Life,Weakness Is Death- Swamy Vivekanand.
SCJP 5.0(87%)
|
 |
Ravikanth kolli
Ranch Hand
Joined: Feb 10, 2008
Posts: 179
|
|
I have never heard anything like a simple variable? do you mean local variable?
|
-kolli
|
 |
Tomendra Singh
Ranch Hand
Joined: Jun 28, 2008
Posts: 47
|
|
sorry i should say simply a variable.i mean when we declare any variable as we declare in general case like:- int a;
|
 |
Henry Wong
author
Sheriff
Joined: Sep 28, 2004
Posts: 16815
|
|
Originally posted by tomendra singh: sorry i should say simply a variable.i mean when we declare any variable as we declare in general case like:- int a;
The difference between an instance variable and a "local" variable, is merely the scope. As long as the variable is in scope, there should be no difference in how they are used. Henry
|
Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
|
 |
Tomendra Singh
Ranch Hand
Joined: Jun 28, 2008
Posts: 47
|
|
thank you wong, but can you tell me please scope of both type of variables and how they are declared differently so that i can easily recognize that which one is instance variable and which one is instance variable. (please explain with an example.)
|
 |
fred rosenberger
lowercase baba
Bartender
Joined: Oct 02, 2003
Posts: 10043
|
|
|
|
Never ascribe to malice that which can be adequately explained by stupidity.
|
 |
Tomendra Singh
Ranch Hand
Joined: Jun 28, 2008
Posts: 47
|
|
|
thank you very very much fred.
|
 |
 |
|
|
subject: difference between instance variable and simple variable
|
|
|