Hi Raj, As per my understanding any member (field or method) is inherited unless it is 1.private in the superclass 2.hidden in the subclass OR 3.overridden in the subclass. Since fields can only be hidden, the static field is inherited if it has not been declared as private in the superclass and also not hidden by another field with the same name in the subclass Eg: class Base { private static int i; \\not inherited since it is private public static int j; \\inherited since it is not private public static int k; \\not inherited since it has been hidden } class Derived extends Base { public static int k; \\hides the field with the same name in the superclass } Hope that helps.
Hi Ray, Static variables will be inherited unless they have a private access modifier. Maybe the following example can help a little:
As you can see you don't even have to have an instance of the KidStatic in order to access the static variable. Greetings, Gian Franco [ January 29, 2004: Message edited by: Gian Franco Casula ]
"Eppur si muove!"
Friends help you move. Good friends help you move bodies. This tiny ad will help: