Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #35594

Re: Changing accessor on public static class

Newsgroups comp.lang.java.programmer
Date 2016-09-13 17:42 -0700
References <eb67e063-898b-4580-9c6f-18a8dae4d95a@googlegroups.com> <dd57e08f-04ae-4858-940c-9d2430212265@googlegroups.com>
Message-ID <32a741ec-258d-45b2-aeae-ac696e7167eb@googlegroups.com> (permalink)
Subject Re: Changing accessor on public static class
From Lew <lewbloch@gmail.com>

Show all headers | View raw


Eric Douglas wrote:
> As Eric S said, a top-level class cannot be static, so we're assuming this is an inner class. 

Not possible. By definition, 
"An inner class is a nested class that is not explicitly or implicitly declared static."
https://docs.oracle.com/javase/specs/jls/se8/html/jls-8.html#jls-8.1.3

> The only point to a static inner class is if you need an instance of it in a static method.

There is no such thing as a "static inner class".

There is a reason to have static nested classes beyond using them in static methods; if a member type doesn't need access to instance members of the containing type, it should not be an inner class.

-- 
Lew

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


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