Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.help > #1564
| Date | 2012-02-14 15:04 -0800 |
|---|---|
| From | Patricia Shanahan <pats@acm.org> |
| Newsgroups | comp.lang.java.help |
| Subject | Re: Global enums and constants |
| References | <f3ad4f4b-a0b0-418e-b859-9bea0e084dda@m5g2000yqk.googlegroups.com> |
| Message-ID | <RPudnfac99PtdafSnZ2dnUVZ_tWdnZ2d@earthlink.com> (permalink) |
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
Back to comp.lang.java.help | Previous | Next — Previous in thread | Find similar
Global enums and constants Davej <galt_57@hotmail.com> - 2012-02-14 14:37 -0800
Re: Global enums and constants Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-02-14 14:53 -0800
Re: Global enums and constants Davej <galt_57@hotmail.com> - 2012-02-14 15:10 -0800
Re: Global enums and constants Patricia Shanahan <pats@acm.org> - 2012-02-14 15:24 -0800
Re: Global enums and constants Davej <galt_57@hotmail.com> - 2012-02-14 15:54 -0800
Re: Global enums and constants Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-02-15 08:31 -0800
Re: Global enums and constants Lew <lewbloch@gmail.com> - 2012-02-15 09:38 -0800
Re: Global enums and constants Roedy Green <see_website@mindprod.com.invalid> - 2012-02-15 14:52 -0800
Re: Global enums and constants Lew <lewbloch@gmail.com> - 2012-02-15 16:28 -0800
Re: Global enums and constants Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2012-02-15 21:30 -0400
Re: Global enums and constants Patricia Shanahan <pats@acm.org> - 2012-02-14 15:04 -0800
csiph-web