Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: blmblm@myrealbox.com Newsgroups: comp.lang.java.programmer Subject: Re: StringBuilder Difficulties Date: 8 Jul 2011 17:45:52 GMT Organization: None Lines: 25 Message-ID: <97ou2gFdmmU2@mid.individual.net> References: <97jiioFr6pU2@mid.individual.net> X-Trace: individual.net GYTbdN8z9dhOBrCIyiS3PQBVs9ZWI8QskbJre8tP0eeHh+B+1S X-Orig-Path: not-for-mail Cancel-Lock: sha1:a3fVr0g+op/O2WMyLMx3xMpN9nk= X-Newsreader: trn 4.0-test76 (Apr 2, 2001) Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:5992 In article , Patricia Shanahan wrote: > On 7/6/2011 4:52 PM, > supercalifragilisticexpialadiamaticonormalizeringelimatisticantations wrote: > ... > > The foreach syntax can also be used with arrays, including arrays of > > unboxed primitives, even though using reflection on an array (e.g. (new > > Object[3]).getClass().getInterfaces();) only shows it implementing > > Cloneable and Serializable, not Iterable. > > The JLS says that the enhanced for statement expression "must either > have type Iterable or else it must be of an array type (§10.1), or a > compile-time error occurs." > > [http://java.sun.com/docs/books/jls/third_edition/html/statements.html#14.14.2] Oh good -- someone else (two someone elses, between them) supplied a better explanation than I did of the circumstances in which the "foreach" syntax can be used. I wanted to mention it in case it was of interest to Gene but was too lazy to do a proper job of describing it. -- B. L. Massingill ObDisclaimer: I don't speak for my employers; they return the favor.