• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

difference between instance variable and simple variable

 
Tomendra Singh
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ravikanth kolli
Ranch Hand
Posts: 179
Chrome Eclipse IDE Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have never heard anything like a simple variable?
do you mean local variable?
 
Tomendra Singh
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Marshal
Pie
Posts: 21518
84
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Tomendra Singh
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12203
35
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Tomendra Singh
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you very very much fred.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic