This is probably a bad thing to do, as discussed in Can parent and child class in Java have same instance variable?. (What if the parent variable name is changed? Then it will not be shadowed anymore.) However, I am still curious whether variables that are differently static/nonstatic will shadow each other. On one hand I would expect they are the same variable name so would be shadowed, but on the other hand it seems like the compiler might distinguish between the two based on staticness.
Share
From The Java Language Specification:
If a method in a superclass refers to a particular field (static or otherwise) of that class, only that class’s declaration of the field will be in scope at that point; any fields (static or otherwise) of subclasses will not be in scope. Therefore, the method will always use the superclass field, even if a subclass inherits it and shadows that field.
This answer is completely rewritten based on my new understanding of the question. Below is my first answer, kept for posterity.
From The Java Language Specification:
This suggests that compilers are required to shadow parent variables, regardless of staticness.
Note that none of this is relevant to inherited methods, which always use the original variables regardless of whether a subclass shadows them. I suspect this isn’t what you meant to ask.