0
When we use keyword static?
2 Answers
+ 1
It's used it in the class whenever you need to create an attribute which is used by all the instances of the class or even if you don't have any instances. It is also used with methods that access private static attributes and it can be called by the class name without having to create objects of the class.
Ex: when you need to create a counter that counts the number of objects created from a specific class
0
When you want to use your method, without creating instance object of that class.