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


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

Re: Array initialization

Started byMarcel Mueller <news.5.maazl@spamgourmet.org>
First post2015-07-30 01:07 +0200
Last post2015-07-30 05:10 +0000
Articles 2 — 2 participants

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 Marcel Mueller <news.5.maazl@spamgourmet.org> - 2015-07-30 01:07 +0200
    Re: Array initialization Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2015-07-30 05:10 +0000

#32201 — Re: Array initialization

FromMarcel Mueller <news.5.maazl@spamgourmet.org>
Date2015-07-30 01:07 +0200
SubjectRe: Array initialization
Message-ID<mpbmb0$snf$3@gwaiyur.mb-net.net>
On 29.07.15 08.06, 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 };

Check for the operator precedence and the execution order and it is obvious.
The operator = is the last one executed. At this point the array already 
exists.

Marcel

[toc] | [next] | [standalone]


#32203

FromAndreas Leitgeb <avl@auth.logic.tuwien.ac.at>
Date2015-07-30 05:10 +0000
Message-ID<slrnmrjcgv.uoi.avl@login.logic.tuwien.ac.at>
In reply to#32201
Stefan Ram <ram@zedat.fu-berlin.de> wrote:
>   [...], especially since this notation 
>   guarantees that the value of all preceding array components
>   always have been given, when the expression for an array
>   component is being read.

Could you elaborate on how this guarantee is less so, otherwise?

[toc] | [prev] | [standalone]


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


csiph-web