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


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

Re: Assignment or Initialization?

From Arne Vajhøj <arne@vajhoej.dk>
Newsgroups comp.lang.java.programmer
Subject Re: Assignment or Initialization?
Date 2016-02-01 20:46 -0500
Organization Aioe.org NNTP Server
Message-ID <n8p1pp$81h$1@gioia.aioe.org> (permalink)
References (1 earlier) <n8oa1b$tq9$2@dont-email.me> <n8ockg$b4a$1@dont-email.me> <n8of62$ku9$1@dont-email.me> <n8oh2r$svq$1@dont-email.me> <n8oufo$dm7$2@jstuckle.eternal-september.org>

Show all headers | View raw


On 2/1/2016 7:52 PM, Jerry Stuckle wrote:
> On 2/1/2016 4:03 PM, Eric Sosman wrote:
>> On 2/1/2016 3:31 PM, Knute Johnson wrote:
>>> public class test {
>>>       final int i;
>>>
>>>       public test() {
>>>           i = 666;
>>>       }
>>> }
>>>
>>> is perfectly legal and used all the time (by me anyway).
>>
>>      That's the case 4ndre4  described: Initialization of a final
>> field in a constructor.  But 4ndre4 seemed to be saying that it's
>> the only legal case, and my point was that there are others.
>>
>
> Actually, I believe it is *assignment* in the constructor.
> Initialization would be :
>
>    public test() : i(666) {
>    }

The above is not in any way valid Java, so definitely no.

Arne

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


Thread

Re: Assignment or Initialization? 4ndre4 <4ndre4@4ndre4.com.invalid> - 2016-02-01 19:03 +0000
  Re: Assignment or Initialization? Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-02-01 14:47 -0500
    Re: Assignment or Initialization? Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2016-02-01 12:31 -0800
      Re: Assignment or Initialization? Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-02-01 16:03 -0500
        Re: Assignment or Initialization? Jerry Stuckle <jstucklex@attglobal.net> - 2016-02-01 19:52 -0500
          Re: Assignment or Initialization? Arne Vajhøj <arne@vajhoej.dk> - 2016-02-01 20:46 -0500
          Re: Assignment or Initialization? Wayne <nospam@all.invalid> - 2016-02-01 23:39 -0500
            Re: Assignment or Initialization? Jerry Stuckle <jstucklex@attglobal.net> - 2016-02-02 09:14 -0500
      Re: Assignment or Initialization? 4ndre4 <4ndre4@4ndre4.com.invalid> - 2016-02-02 19:25 +0000
  Re: Assignment or Initialization? Eric Douglas <e.d.programmer@gmail.com> - 2016-02-01 13:13 -0800
    Re: Assignment or Initialization? 4ndre4 <4ndre4@4ndre4.com.invalid> - 2016-02-02 19:26 +0000
  Re: Assignment or Initialization? Arne Vajhøj <arne@vajhoej.dk> - 2016-02-01 20:55 -0500
    Re: Assignment or Initialization? 4ndre4 <4ndre4@4ndre4.com.invalid> - 2016-02-02 19:29 +0000
      Re: Assignment or Initialization? Eric Douglas <e.d.programmer@gmail.com> - 2016-02-02 11:44 -0800
        Re: Assignment or Initialization? Lew <lewbloch@gmail.com> - 2016-02-02 13:16 -0800
      Re: Assignment or Initialization? Lew <lewbloch@gmail.com> - 2016-02-02 13:15 -0800
      Re: Assignment or Initialization? Arne Vajhøj <arne@vajhoej.dk> - 2016-02-02 18:13 -0500
      Re: Assignment or Initialization? Silvio <silvio@internet.com> - 2016-02-03 12:10 +0100
        Re: Assignment or Initialization? Eric Douglas <e.d.programmer@gmail.com> - 2016-02-03 05:14 -0800
          Re: Assignment or Initialization? Lew <lewbloch@gmail.com> - 2016-02-03 13:39 -0800
  Re: Assignment or Initialization? Lew <lewbloch@gmail.com> - 2016-02-02 10:32 -0800
    Re: Assignment or Initialization? 4ndre4 <4ndre4@4ndre4.com.invalid> - 2016-02-02 19:22 +0000
  Re: Assignment or Initialization? Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2016-02-03 09:03 -0800

csiph-web