Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail NNTP-Posting-Date: Tue, 14 Feb 2012 17:04:16 -0600 Date: Tue, 14 Feb 2012 15:04:00 -0800 From: Patricia Shanahan User-Agent: Thunderbird 1.5.0.2 (Windows/20060308) MIME-Version: 1.0 Newsgroups: comp.lang.java.help Subject: Re: Global enums and constants References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: Lines: 18 X-Usenet-Provider: http://www.giganews.com NNTP-Posting-Host: 70.230.206.198 X-Trace: sv3-u6w6R7Snju4K5kymJgTgL/9wrDRgdqUaJubWluCMm8sIFEBFLzwQGri84qDBpd1GqVkdp26s1u1et8F!HJqa+HWYxKDcD52GJMgVbF+viNCyyc5vD6DXTCZfcIWPvE82kjmi9j3qGJe4LufkJDEplVzF1fWJ!MC6viNbaQlrVky+oPzizq89FnzxqBkGhkhZssqm5JLeRY2Q= X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 1807 Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.help:1564 Davej wrote: > I'm having trouble accessing constants. I know it is always best to > define a constant in only one place, but public or private I still > can't see it. What am I doing wrong? Thanks. How are you declaring and referencing it? Note that there are no truly global constants in Java. It will be declared in some class, call it field X in class SomeClass. Assuming X is declared as public static final int in class SomeClass. You can reference it, assuming you can reference SomeClass, as "SomeClass.X". If you want to avoid qualifying X with the class name, look into "import static". Patricia