+ 2
Why declare a static variable
the word "static" allows a method to execute without having to create an instance of the class that contains it. What about a variable declare static ... ?? in which case did you declare a static variable ?? is there any disadvantage
3 Respostas
+ 5
To maintain data relevant to the whole range of objects within a class and not just relevant to a single object.
0
thank you very much for all your answers they helped me a lot......
if I understand correctly a static variable is specific to the class. Thus, if multiple objects are instantiated from any class, relative to the instance variables. which they can be different from one object to another, the static variables will be the same for all the objects of this class from where the interest to declare them static ...