A variable is used for storing a value either a number or a character and a variable also vary its
value means it may change his value Variables are used for given names to locations in the
Memory of Computer where the different constants are stored. These locations contain Integer
,Real or Character Constants.
Scope of Variables
There are three types of Variables Those are as follows:-
Instance Variables
The Variables those are declared in a class are known as instance variables When object of Class is Created then instance Variables are Created So they always Related With Class Object But
Remember Only one memory location is created for one instance variable.
Local Variables
The Variables those are declared in Method of class are known as Local Variables They are
Called Local because they are not used from outside the method The Accessibility of Variables
Throughout the program is called is Known as the Scope of Variables.
Class Variables
The Variables Those are declared inside a class are called as Class variables or also called as
data members of the class they are friendly by default means they are Accessible to main Method
or any other Class Which inherits.