Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #35568
| Path | csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Eric Sosman <esosman@comcast-dot-net.invalid> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Changing accessor on public static class |
| Date | Thu, 8 Sep 2016 08:38:09 -0400 |
| Organization | A noiseless patient Spider |
| Lines | 30 |
| Message-ID | <nqrm3k$tl8$1@dont-email.me> (permalink) |
| References | <eb67e063-898b-4580-9c6f-18a8dae4d95a@googlegroups.com> <dd57e08f-04ae-4858-940c-9d2430212265@googlegroups.com> <nqnjl3$13g4$3@gioia.aioe.org> <734645c0-69c9-4ee2-a9c2-191b9f3710ab@googlegroups.com> <nqq5nk$vad$1@gioia.aioe.org> <6d2c31d9-1701-404e-b76d-1d1c6510a411@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8; format=flowed |
| Content-Transfer-Encoding | 8bit |
| Injection-Date | Thu, 8 Sep 2016 12:38:12 -0000 (UTC) |
| Injection-Info | mx02.eternal-september.org; posting-host="22e5ab429c5a4bb738666b9c52e40d69"; logging-data="30376"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18JplperPLKM/D9ffWAtTQF" |
| User-Agent | Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 |
| In-Reply-To | <6d2c31d9-1701-404e-b76d-1d1c6510a411@googlegroups.com> |
| Cancel-Lock | sha1:09+qY1euDSjpQ97mxQU3k5PNuW8= |
| Xref | csiph.com comp.lang.java.programmer:35568 |
Show key headers only | View raw
On 9/8/2016 7:54 AM, Eric Douglas wrote:
> On Wednesday, September 7, 2016 at 6:52:53 PM UTC-4, Arne Vajhøj wrote:
>> So your decision logic should be:
>>
>> if I want to put class declaration within another class then
>> if the class really need to refer directly to members of the
>> enclosing instance then
>> use inner class
>> else
>> use static nested class
>> end if
>> else
>> use a normal class
>> end if
>>
>> Arne
>
> I'm not sure what you're saying. I have plenty of inner classes but I've only ever made them static when there's a need to instantiate them from a static method or static block.
Do you have a copy of "Effective Java" by Joshua Bloch? If not,
I strongly recommend you get one; it's an excellent work that I think
will improve just about anyone's Java.
When you get the book, read "Item 18: Favor static member classes
over nonstatic" for Bloch's take on the pros and cons of static nested
classes vs. inner classes.
--
esosman@comcast-dot-net.invalid
The Tooth Fairy has gone high-tech, now pays in Bitecoin.
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Changing accessor on public static class mike <mikaelpetterson@hotmail.com> - 2016-09-06 00:53 -0700
Re: Changing accessor on public static class Alberto Salvati <zzzato@gmail.com> - 2016-09-06 01:12 -0700
Re: Changing accessor on public static class Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-09-06 09:08 -0400
Re: Changing accessor on public static class Andreas Leitgeb <avl@logic.at> - 2016-09-06 23:00 +0000
Re: Changing accessor on public static class Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-09-07 07:48 -0400
Re: Changing accessor on public static class Eric Douglas <e.d.programmer@gmail.com> - 2016-09-06 07:00 -0700
Re: Changing accessor on public static class Arne Vajhøj <arne@vajhoej.dk> - 2016-09-06 19:31 -0400
Re: Changing accessor on public static class Eric Douglas <e.d.programmer@gmail.com> - 2016-09-07 04:47 -0700
Re: Changing accessor on public static class Arne Vajhøj <arne@vajhoej.dk> - 2016-09-07 18:52 -0400
Re: Changing accessor on public static class Eric Douglas <e.d.programmer@gmail.com> - 2016-09-08 04:54 -0700
Re: Changing accessor on public static class Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-09-08 08:38 -0400
Re: Changing accessor on public static class Eric Douglas <e.d.programmer@gmail.com> - 2016-09-08 06:35 -0700
Re: Changing accessor on public static class Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-09-08 10:09 -0400
Re: Changing accessor on public static class Eric Douglas <e.d.programmer@gmail.com> - 2016-09-08 08:18 -0700
Re: Changing accessor on public static class Eric Douglas <e.d.programmer@gmail.com> - 2016-09-08 08:37 -0700
Re: Changing accessor on public static class Arne Vajhøj <arne@vajhoej.dk> - 2016-09-08 19:34 -0400
Re: Changing accessor on public static class Arne Vajhøj <arne@vajhoej.dk> - 2016-09-08 19:32 -0400
Re: Changing accessor on public static class Arne Vajhøj <arne@vajhoej.dk> - 2016-09-08 19:30 -0400
Re: Changing accessor on public static class Arne Vajhøj <arne@vajhoej.dk> - 2016-09-08 21:50 -0400
Re: Changing accessor on public static class Lew <lewbloch@gmail.com> - 2016-09-13 17:44 -0700
Re: Changing accessor on public static class Lew <lewbloch@gmail.com> - 2016-09-13 17:42 -0700
Re: Changing accessor on public static class Arne Vajhøj <arne@vajhoej.dk> - 2016-09-06 19:33 -0400
Re: Changing accessor on public static class Lew <lewbloch@gmail.com> - 2016-09-13 17:39 -0700
csiph-web