Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!nx02.iad01.newshosting.com!newshosting.com!69.16.185.11.MISMATCH!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!postnews.google.com!news3.google.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Robert Klemme Newsgroups: comp.lang.java.programmer Subject: Re: Style Police (a rant) Date: Mon, 29 Aug 2011 18:21:10 +0200 Lines: 42 Message-ID: <9c1sjvF1hdU1@mid.individual.net> References: <36f4953c-f085-4850-85eb-bb248a8cf1bb@glegroupsg2000goo.googlegroups.com> <252cd91f-0695-4cda-8ba0-70cfbc5fbd7a@glegroupsg2000goo.googlegroups.com> <78817664-363f-4e73-99e5-ef3c0a3566af@glegroupsg2000goo.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable X-Trace: individual.net Xcgckm478TzsA4FPQEp5xAi4JH1TwaAxRR58LoR+QR6BABavw= Cancel-Lock: sha1:2d3wuIyEd/wnpf45rtfi7bsf8jQ= User-Agent: Mozilla/5.0 (Windows NT 6.0; WOW64; rv:6.0) Gecko/20110812 Thunderbird/6.0 In-Reply-To: Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:7472 On 29.08.2011 09:44, Jan Burse wrote: > Lew schrieb: >> "A private method and all methods declared immediately > > within a final class (=A78.1.1.2) behave as if they are > > final, since it is impossible to override them." > > The above refers to a final class and not to a final > method. Read like this: "(A private method) and (all methods declared=20 immediately within a final class (=A78.1.1.2)) behave as if they are=20 final, since it is impossible to override them." In other words P"final"(m) OR P"declared immediately within a final class"(m) =3D>=20 P"behaves as if final"(m). > private methods can be overshadowed. You can try the > following code by yourself: > > class A { > private void init() { }; > } > > class B extends A { > public void init() { }; > } > > It does compile, and the class loader does also > accept it. But you can never invoke A.init() from methods in B or descendants.=20 A.init() is final because it can only ever be seen in A. Kind regards robert --=20 remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/