Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Where to declare global constants?

Hi;
If I have a project with a few java files and I want to declare a constant variable that all classes will have access to it, where do I write:
public static final int ROWS = 8;
thanks
[214 byte] By [oh_crap] at [2007-11-11 8:17:49]
# 1 Re: Where to declare global constants?
Make a class called MyConstants, then add the static variables there.

MyConstants.ROWS
Phaelax at 2007-11-11 22:35:50 >
# 2 Re: Where to declare global constants?
Anything public is "global".
destin at 2007-11-11 22:36:55 >
# 3 Re: Where to declare global constants?
Should be static public. if it is only public then there will be separate instances.
arul at 2007-11-11 22:37:54 >