[1610] in java-interest

home help back first fref pref prev next nref lref last post

question about static variables

daemon@ATHENA.MIT.EDU (Jeff White)
Sun Sep 10 02:07:58 1995

From: Jeff White <jsw@cs.brown.edu>
Date: Sat, 9 Sep 1995 22:10:38 -0400
To: java-interest@java.sun.com
Reply-To: jsw@cs.brown.edu



Are public static variables inherited in subclasses?  I would think
that since they're static and refer to the class itself - not
instances, that they would not be inherited.  When I try to override a
pubic static final static variable I get no error in compiling my java
source.  

The output of javah seems to indicate that they are indeed inherited
though.  It does a #define for these variables, and includes the
parent class's static variables as well, which cause a c error because
then the same name is being #define'd twice...  

So, either way, it seems that either javac should complain, or javah
shouldn't do the parental #defines.

thanks,
jeff

 --------------------------------------------------------------------
| Jeff White jsw@cs.brown.edu http://www.cs.brown.edu/people/jsw/    |
| "So you run and you run to catch up with the sun but it's sinking  |
| Racing around to come up behind you again" - pink floyd            |
 --------------------------------------------------------------------
-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post