Search

Friday, April 23, 2010

What is the difference between an instance variable and a static variable?

Static variable : Class variable is called as static variable , there is only one occurrence of this variable inside the JVM per class loader.During a load of class static variable initialize.
Instance variable : Is called object variable and there is only one copy per object .

Static variable act as Global variable and shared across the all instances of the class.

No comments:

Post a Comment