why using static keyword
The static variable is declared by using static keyword. Following is an example of static declaration:
static int i=10;
The variable declared with static keyword is called class variable. This variable is shared by all the instances of the class. The static variable can be accessed without creating the instance of the class.
This variable is created statically and same variable is accessed by all instance of the class.
Check the tutorial static Java Keyword.
static variable & static methode is directly access with help of class name. mean static variable or method belong only class name.
What is Static Keyword In Java,the Static Keyword enables a class/ method / or variables accessible without creating an instance of the class that contains the Static methods and variables.
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.