If a variable is declared as public static varName;
, then I can access it from anywhere as ClassName.varName
. I am also aware that static members are shared by all instances of a class and are not reallocated in each instance.
Is declaring a variable as private static varName;
any different from declaring a variable private varName;
?
In both cases it cannot be accessed as ClassName.varName
or as ClassInstance.varName
from any other class.
Does declaring the variable as static give it other special properties?