Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!npeer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail From: Lew Newsgroups: comp.lang.java.programmer Subject: Re: "Small" Program Challenge. Date: Mon, 18 Jun 2012 14:18:54 -0700 (PDT) Organization: http://groups.google.com Lines: 24 Message-ID: References: <4fde76ce$0$287$14726298@news.sunsite.dk> <20ad5d23-f0a7-4926-9d99-b9dc0a7ea18e@googlegroups.com> NNTP-Posting-Host: 69.28.149.29 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: posting.google.com 1340056900 1576 127.0.0.1 (18 Jun 2012 22:01:40 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 18 Jun 2012 22:01:40 +0000 (UTC) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=69.28.149.29; posting-account=CP-lKQoAAAAGtB5diOuGlDQk0jIwmH0T User-Agent: G2/1.0 X-Received-Bytes: 2314 Xref: csiph.com comp.lang.java.programmer:15396 Leif Roar Moldskred wrote: > Lew wrote: > > "Invocation of certain reflective methods in class Class and in > > package java.lang.reflect also causes class or interface > > initialization." > > Might this be what is happening? The JLS doesn't seem to specify _how_ > the main method should be invoked, so might not a Java implementation > do so through reflection and thus trigger the initialization of the > class? There was no 'main()' method in the example under discussion. The JLS says that the JVM is started by invocation of a 'main()' method. Without such an invocation, nothing should have been able to call any of the static methods of the 'enum' or otherwise triggered initialization of that class. The class initialized anyway. Ergo the process didn't follow the JLS. -- Lew