If static members are not inherited in Java then why access modifiers (private, protected…) are applicable to them?
Perhaps, I’m not 100% clear on the term “inherited”: when they say “statics not inherited” do they mean “not visible” or “can not be redefined/reimplemented” or both?
Would it be correct to say that access modifiers imply only visibility when speaking about static class members, and visibility as well as reimplementation possibility when speaking about regular class members?
Can you please provide examples when making static, say, private makes sense?
Thanks
PS: Now I think that the statement "Static variables in Java are not inherited, they exist only in the class which declares them" spread here and there and around on this forum (for instance: What are the rules dictating the inheritance of static variables in Java?) IS NOT correct as
The Java Language Specification #8.4.8 states:
8.4.8 Inheritance, Overriding, and Hiding
A class C inherits from its direct superclass all concrete methods m (both static and instance) of the superclass for which all of the following are true:
m is a member of the direct superclass of C. m is public, protected, or declared with package access in the same package as C. No method declared in C has a signature that is a subsignature (§8.4.2) of the signature of m.