Types of variables in JAVA:
• Whenever we develop any JAVA program that will be developed with respect to class only.
• In a class we can use ‘n’ number of data members and ‘n’ number of methods.
• Generally in JAVA, we can use two types of data members or variables. They are
instance/non-static variables and static variables.
1) An instance variable is one whose
memory space is creating each and
every time whenever an object is
2) Programmatically instance variable
declaration should not be preceded
by keyword static.
3) Data type v1, v2…vn;
4) Instance variable must be accessed
with respect to object name i.e.,
5) Value of instance variable is not
6) Instance variable are also known as
object level data members since they
are dependent on objects.
1) Static variables are whose memory
space is creating only once when the
class is loaded by class loader
subsystem (a part of JVM) in the main
memory irrespective of number of
2) Programmatically static variable
declaration must be preceded by
3) Static data type v1, v2…vn;
4) Static variables must be accessed
with respect to class name i.e.,
5) Value of static variable is always
recommended for sharable.
6) Static variable are also known as class
level data members since they are
dependent on classes.