Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.help > #2286
| From | Roedy Green <see_website@mindprod.com.invalid> |
|---|---|
| Newsgroups | comp.lang.java.help |
| Subject | Re: static context puzzle |
| Date | 2012-11-28 04:21 -0800 |
| Organization | Canadian Mind Products |
| Message-ID | <mutbb8l9c392t5ocrm952p59out7hcnka8@4ax.com> (permalink) |
| References | <eksbb851shsvfnllarvd02dt56eenlltt7@4ax.com> |
On Wed, 28 Nov 2012 03:18:25 -0800, Roedy Green <see_website@mindprod.com.invalid> wrote, quoted or indirectly quoted someone who said : >I have prepared the following SSCCE to demonstrate a puzzle. >The compiler is complaining about using an instance method in a static >context. It looks fine to me. What am I overlooking? The secret to making it work is to remove the keyword "private" from private int chooseAnAdVariant( final File fileBeingProcessed The error message is misleading. Inner classes cannot see the parent's private methods. Methods attached to individual enum constants are inner classes of the enum as a whole under the hood. -- Roedy Green Canadian Mind Products http://mindprod.com Students who hire or con others to do their homework are as foolish as couch potatoes who hire others to go to the gym for them.
Back to comp.lang.java.help | Previous | Next — Previous in thread | Find similar | Unroll thread
static context puzzle Roedy Green <see_website@mindprod.com.invalid> - 2012-11-28 03:18 -0800 Re: static context puzzle Roedy Green <see_website@mindprod.com.invalid> - 2012-11-28 04:21 -0800
csiph-web