+ 1
Why do we use static in Java?
In hello world, just after declaring class
3 Respostas
+ 3
Because without static, you have to create an Object of the class. Because there aren't any objects before your main function is called, it has to be declared as static.
+ 3
Just soo you can avoid the laziness of instantiating objects for that class before you can use its variables and methods