Short answer: no, this is not possible. You have mixed up some terminology. Hiding has nothing to do with accessibility (which you really ask, not about visibility, which is related to scope and shading and is discussed in Chapter 6, Java Language Specification (JLS ).
Now for a longer answer. The term override applies to instance methods, while the term "hiding" applies to class methods ( static ). From the Java Tutorial section . Override and Hide Methods :
The difference between hiding a static method and overriding an instance method has important consequences:
- The version of the overridden instance method that is being called is one in the subclass.
- The version of the hidden static method that is being called depends on whether it is called from a superclass or subclass.
Some of the other answers here give incorrect examples about hiding a method, so back to JLS, this time §8.4.8
Methods are overridden or hiding signature signatures.
That is, in order to override or hide the method in the parent class, the subclass must define a method with the same signature - basically the same number and type of arguments (although generalizing and deleting types makes the rules a little more complicated than that). There are also rules about return types and throws clauses, but they are not relevant to this issue.
Note that you can define a method in a subclass with the same name as the method in the parent class (or in the implemented interface), but with a different number or type of arguments. In this case, you overload the method name and neither override nor hide anything; a subclass method is a new method that is virtually independent of the inherited method (s). (There is interaction when the compiler must map methods to method calls, but more on that.)
Now to your question: the terms “accessibility and concealment” (as well as visibility) are independent concepts in Java. There is, as you put it, a “principle” that there is simply no way for a subclass to reduce the availability of an inherited method. This applies regardless of whether you override the instance method or hide the class method. From JLS §8.4.8.3 :
The access modifier ( §6.6 ) of the override or hide method must provide at least the same access as the overridden or hidden method, because as follows:
If the overridden or hidden method is public , then the override or hide method must be public ; otherwise, a compile-time error occurs.
If the overridden or hidden method is protected , then the override or hide method must be protected or public ; otherwise, a compile-time error occurs.
If an overridden or hidden method has default access (package), then the override or hide method should not be private ; otherwise, a compile-time error occurs.
Thus, the fact that the static method can be hidden has nothing to do with changing the availability of the method.