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


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

Re: Array initialization

Started byDaniel Pitts <newsgroup.nospam@virtualinfinity.net>
First post2015-07-29 13:52 -0700
Last post2015-07-29 13:52 -0700
Articles 1 — 1 participant

Back to article view | Back to comp.lang.java.programmer

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

#32198 — Re: Array initialization

FromDaniel Pitts <newsgroup.nospam@virtualinfinity.net>
Date2015-07-29 13:52 -0700
SubjectRe: Array initialization
Message-ID<G2bux.9980$VD4.2272@fx07.iad>
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.

[toc] | [standalone]


Back to top | Article view | comp.lang.java.programmer


csiph-web