static is a non-access modifier in Java which is used mainly for the purpose of memory management. static belongs to the class instead of the instance of the class. static keyword can be used with:
1. Variables
2. Methods
3. Nested Classes
4. Blocks
In order to create a static member, we need to write the keyword static preceding the declaration of the member.
Static Variables
If a variable is declared as static:
Output:
10
20
1. Variables
2. Methods
3. Nested Classes
4. Blocks
In order to create a static member, we need to write the keyword static preceding the declaration of the member.
Static Variables
If a variable is declared as static:
- It will get memory only once in the class area at the time of class loading.
- The single copy of this variable will be shared among all the instances of the class.
Example of the static variable
Output:
10
20
King Casino Login | All your games online and - Community Khabar
ReplyDeleteLogin King gri-go.com Casino, novcasino Play, and 바카라 사이트 Win! Login King Casino, Play. Login King Casino, Play. Login King Casino, Play. Login King Casino, Play. communitykhabar Login King https://sol.edu.kg/ Casino, Play. Login King Casino,