|
The keyword static also means that the variable declared as static are used as a class variable, in terms of that there exist only one copy of this variable in the memory, no matter how much instance that class have
If u don't use the static keyword, when each instance are constructed they would get each a acopy of the variable, but if it's declared static, then the variable refer to the class variable in which if u modify the variable in an instance, then the rest of the other instances also get the effect
Since it's static, and just like we have discussed before are considered as a class variable or class method, we don't need to instantiate an object to use it, instead we just use the classname.variable or classname.method() to call it
|