Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #32198

Re: Array initialization

Path csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!peer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post01.iad.highwinds-media.com!fx07.iad.POSTED!not-for-mail
From Daniel Pitts <newsgroup.nospam@virtualinfinity.net>
User-Agent Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.7.0
MIME-Version 1.0
Newsgroups comp.lang.java.programmer
Subject Re: Array initialization
References <Array-20150729080212@ram.dialup.fu-berlin.de>
In-Reply-To <Array-20150729080212@ram.dialup.fu-berlin.de>
Content-Type text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding 7bit
Lines 21
Message-ID <G2bux.9980$VD4.2272@fx07.iad> (permalink)
X-Complaints-To abuse@newsrazor.net
NNTP-Posting-Date Wed, 29 Jul 2015 20:52:54 UTC
Date Wed, 29 Jul 2015 13:52:54 -0700
X-Received-Bytes 1432
X-Received-Body-CRC 3112876649
Xref csiph.com comp.lang.java.programmer:32198

Show key headers only | View raw


On 7/28/15 11:06 PM, Stefan Ram wrote:
>    Recently, being away from the keyboard, I wondered whether
>    the following was legal in Java:
>
> public final class Main
> { public static void main( final java.lang.String[] args )
>    { int a[] ={ 0, a[ 0 ] + 1, a[ 1 ]+ 1 };
>     java.lang.System.out.println( a[ 0 ]);
>     java.lang.System.out.println( a[ 1 ]);
>     java.lang.System.out.println( a[ 2 ]); }}
>
>    Turned out, I got an error message:
>
> Main.java:3: error: variable a might not have been initialized
>    { int a[] ={ 0, a[ 0 ]+ 1, a[ 1 ]+ 1 };
>                    ^
> 1 error
>


Yep, that makes total sense. I wouldn't expect anything different.

Back to comp.lang.java.programmer | Previous | Next | Find similar | Unroll thread


Thread

Re: Array initialization Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2015-07-29 13:52 -0700

csiph-web