Good morning my dear friends.Today I am going to show you the way about the LIFE TIME OF THE VARIABLES.
Normally we can see three types of VARIABLES in programing.
Those are instant variables,static varable and local variables.
Now let us describe each of this.
What is the life time of a variable??????.
Yes...
During the execution of a Java program, each variable has its own time within which it can be accessed.
This is called the lifetime of the variable.
1. Instant variable
Instant variables belongs to the class.So each object will have a copy of it's instant variables.
2. static variable
static variables are also belongs to the class.But can not belong to any object created from the class.
Therefore static variables are created only when the class is loaded at runtime.
So the life time of the static variable is exsist as long as the class excist.
3.local variables
Local variables belongs only to the scope of the method or block.
After the execute of the method these local variables are not be accessible.
In future I will describe you giving example.
That is all for today.Bye.... :D
Normally we can see three types of VARIABLES in programing.
Those are instant variables,static varable and local variables.
Now let us describe each of this.
What is the life time of a variable??????.
Yes...
During the execution of a Java program, each variable has its own time within which it can be accessed.
This is called the lifetime of the variable.
1. Instant variable
Instant variables belongs to the class.So each object will have a copy of it's instant variables.
2. static variable
static variables are also belongs to the class.But can not belong to any object created from the class.
Therefore static variables are created only when the class is loaded at runtime.
So the life time of the static variable is exsist as long as the class excist.
3.local variables
Local variables belongs only to the scope of the method or block.
After the execute of the method these local variables are not be accessible.
In future I will describe you giving example.
That is all for today.Bye.... :D