+ 1
What is static ?
what is the meaning of static in java.
4 Réponses
+ 10
If you're just starting with Java, the short answer is "don't worry about it". You'll find out about it later.
The long answer is that static allows you to use a class without making an object from it. The class main() is in must be static, because no code can run that can create any objects until main() starts. If that class and main() isn't static, main() can't run.
+ 3
static makes the member bound to the class. Without the use of static the member would be from an instance of the class.
The result of this is what the others are saying, where you don't need to make an instance of the class to access the member.
+ 2
Static allows you to call a method, even if you never created an object to which that method would belong to. Also static members variables are shared by all instances of the class to which they belong.
+ 1
Concept of static block:-->> https://code.sololearn.com/cIGErO46yaid/?ref=app