Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!nx01.iad01.newshosting.com!newshosting.com!news-out.readnews.com!transit3.readnews.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail From: Lew Newsgroups: comp.lang.java.programmer Subject: Re: borrowing Constants Date: Fri, 23 Sep 2011 19:26:30 -0700 (PDT) Organization: http://groups.google.com Lines: 31 Message-ID: <12905732.2457.1316831190534.JavaMail.geo-discussion-forums@prfh23> References: <26090658.2452.1316830316920.JavaMail.geo-discussion-forums@prfh23> Reply-To: comp.lang.java.programmer@googlegroups.com NNTP-Posting-Host: 24.6.43.78 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1316831190 2465 127.0.0.1 (24 Sep 2011 02:26:30 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sat, 24 Sep 2011 02:26:30 +0000 (UTC) In-Reply-To: <26090658.2452.1316830316920.JavaMail.geo-discussion-forums@prfh23> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=24.6.43.78; posting-account=CP-lKQoAAAAGtB5diOuGlDQk0jIwmH0T User-Agent: G2/1.0 X-Google-Web-Client: true Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:8256 Lew wrote: > Roedy Green wrote: >> When you use Class B, does all of class A get instantiated? >=20 > Strictly speaking, and I am fairly sure you don't mean this, a class with= only static members might never, or cannot ever be instantiated (depending= on the use of certain idioms). >=20 > As you know, I favor exactitude, some think colo-rectitude in certain ter= minologies. =20 > It cuts both ways - I have to relearn terms when I have them wrong. For example, Roedy correctly points out that classes do have a class object= that instantiates when they load. =20 There are two main stages to the usefulness of a type at runtime. One is l= oad, the other initialize. They're like two steps in each class's private = Big Bang of creation. A class loads among other things upon reference to that class's instance va= riable, pointed to by the 'class' attribute. Under that particular circums= tance it does not also initialize. That happens under non-pathological ref= erences to classes, such as access to behaviors or contents through their m= embers. ('class' is not a member.) 'final' fields, especially 'static' on= es, most especially compile-time constant variables, get special treatment = in the initialization. I'll stop now. --=20 Lew