aspose file tools
The moose likes Beginning Java and the fly likes difference between instance variable and simple variable Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "difference between instance variable and simple variable" Watch "difference between instance variable and simple variable" New topic
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
    
  19

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
    
    6



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.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: difference between instance variable and simple variable
 
Similar Threads
Difference between Static and Instance variable
Instance and Reference variables
instance/reference
What's the difference between instance variable and class variable?
variables in static methods