CVGalleryGamesPreviewRandomJavaSiteWeb
Site updates
Testing New System now...

Static

WIP - Please Wait...

Static is not only what you see on a badly tuned in TV, it's also what is used to say a method, variable or constant should be associated with the class, rather than an instance.

You are probably most familiar with the use of this for constants, such as private static final int TV_JOKE_LAUGHS = 0;. However, methods can be static as well. This can be used to make a request for a class constant, if it had been declared private, such as getHowFunny().

Generally, any objects, methods or variables used by a static method also need to be static.

If you get an error message about making a static/nonstatic reference to a class, you need to instantiate it or not (the opposite of what you were doing).

NOTE: The Java section is mostly in maintenence mode. I don't have time to work on it right now. Errors will be corrected if pointed out, but they are not actively being searched for. Newer site features, like alternate stylesheets, may cause problems with these pages.