Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!.POSTED!not-for-mail From: Roedy Green Newsgroups: comp.lang.java.help Subject: Re: Enum basics Date: Sat, 05 Nov 2011 04:18:07 -0700 Organization: Canadian Mind Products Lines: 29 Message-ID: <1h6ab71vo4kgbblc8dnbl8dne9l35q80f2@4ax.com> References: <3bo8b7dd306f6pj50v2jk3t9704n1c0cjp@4ax.com> Reply-To: Roedy Green NNTP-Posting-Host: Z2l1DcCELS0rATq8NqV4Sw.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org X-Notice: Filtered by postfilter v. 0.8.2 X-Newsreader: Forte Agent 6.00/32.1186 Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.help:1288 On Fri, 04 Nov 2011 15:11:45 -0700, Roedy Green wrote, quoted or indirectly quoted someone who said : >Are enums supposed to support static variables? static methods? I wrote an SSCCE to sort this out. See http://mindprod.com/jgloss/enum.html#VARIABLESCOPE The bottom line is: enums can have static variables shared between all enum constants and instance variables. Nested enums can access the static final constants and static variables of the enclosing class, but not its instance variables. static and instance methods behave similarly. Implicitly, a nested enum is a nested static class, so this is the expected behaviour. -- Roedy Green Canadian Mind Products http://mindprod.com Capitalism has spurred the competition that makes CPUs faster and faster each year, but the focus on money makes software manufacturers do some peculiar things like deliberately leaving bugs and deficiencies in the software so they can soak the customers for upgrades later. Whether software is easy to use, or never loses data, when the company has a near monopoly, is almost irrelevant to profits, and therefore ignored. The manufacturer focuses on cheap gimicks like dancing paper clips to dazzle naive first-time buyers. The needs of existing experienced users are almost irrelevant. I see software rental as the best remedy.