[Garrett-Smiths-Computer:java/practice/static] garrett%
java SubberClass
10
10
0
The thing to remember is that you're hiding the variable and that hiding is limited to the subclass. If you want SubberClass value of the constant, you'll have to use CONSTANT within SubberClass
or use SubberClass.CONSTANT.
Here's a program that demonstrates the scope hidden static members.
In addition to hiding static variables, you can hide static methods, and even instance methods and variables. See Ch 8 of the JLS.
It's a stupid trick and totally impractical. I wouldn't do this in a professional setting, or even in my own development, especially if you're prone to donut-induced confusion!
(fixed the forum tags)
[ March 01, 2003: Message edited by: Garrett Smith ]