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


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

Re: Assignment or Initialization?

Started byArne Vajhøj <arne@vajhoej.dk>
First post2016-02-01 20:57 -0500
Last post2016-02-01 20:57 -0500
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: Assignment or Initialization? Arne Vajhøj <arne@vajhoej.dk> - 2016-02-01 20:57 -0500

#33559 — Re: Assignment or Initialization?

FromArne Vajhøj <arne@vajhoej.dk>
Date2016-02-01 20:57 -0500
SubjectRe: Assignment or Initialization?
Message-ID<n8p2ea$8jg$2@gioia.aioe.org>
On 2/1/2016 7:23 AM, Stefan Ram wrote:
>    In
>
> int i = 2;
> i = 3;
>
>    , there is an initialization and then an assignment.
>
>    What about
>
> final int i;
> i = 3;
>
>    ? Is »i = 3« an assignment or an initialization or both?
>
>    No, wait! I have looked up the JLS. It says that
>    »int i = 2;« is an assignment, too.
>
>        »14.4.2 ... If a declarator has an initializer, the
>         initializer is evaluated and its value is assigned
>         to the variable.«                         ¯¯¯¯¯¯¯¯

Often studying JLS has little practical importance.

But for a question like what some valid Java syntax is correctly
called in Java then JLS is obviously the best source.

Arne

[toc] | [standalone]


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


csiph-web