4th Day @ Noida: Static and non- static
Hi Readers! I came to know today about one of the best parts of Java. I mean the joyful learning with static and non-static concept in java.
There is three type of variable in java.
There is three type of variable in java.
- Local variable
- Global varible also known as static variable
- non-static variable.
Local Variable:
The variables which are declared inside a function in a Java program and its scope is up to that function only.
Non-Static Variable:
This type of variables is known as object variables because these variables are generated with every object of that class. It is also known as an instance variable.
Static variable:
This type of variables is called a class variable and it is generated only once for a particular class.
Moreover, we can use a static variable to serve all the functions inside the class for all objects.
Comments
Post a Comment
Thank you!