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


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

Re: A freshman's question

From Tim Slattery <Slattery_T@bls.gov>
Newsgroups comp.lang.java.programmer
Subject Re: A freshman's question
Date 2011-10-19 12:24 -0400
Organization A noiseless patient Spider
Message-ID <g8ut97dqh0067547ck6pcj9h0aiiq27lao@4ax.com> (permalink)
References (1 earlier) <37KdnWZAYfIR1QPTnZ2dnUVZ_vWdnZ2d@earthlink.com> <02a66b06-651a-46c8-9a09-64442a73a959@s17g2000prm.googlegroups.com> <F4mdnVWUC_HXFQPTnZ2dnUVZ_oednZ2d@earthlink.com> <4df1e05a-295c-4c60-9baf-0e69cd4ee507@r2g2000prh.googlegroups.com> <4E9EF14F.1040904@telia.com>

Show all headers | View raw


Lars Enderin <lars.enderin@telia.com> wrote:


>1) i = 0;
>    inc.fermin(i);
>The method fermin() is useless. It has no effect. The parameter is not
>the same i, just a copy of the actual value. The statement i++; in the
>method has no effect outside the method.
>So i remains == 0.

No question.

>2) i  = i++;
>This is an assignment. First, the expression i++ is evaluated. Its value
>is 0, the initial value of i. This 0 is then assigned to i, which thus
>remains == 0.

Lessee....I think this is the sequence:

1. evaluate i, that yields 0
2. increment i, so that i is 1 for a second.
3. Now assign the value you got from evaluating i in step 1 to i. So i
is reset to 0.

Does that sound right?

-- 
Tim Slattery
Slattery_T@bls.gov
http://members.cox.net/slatteryt

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


Thread

A freshman's question whl <wanghailunmail@gmail.com> - 2011-10-18 20:08 -0700
  Re: A freshman's question Patricia Shanahan <pats@acm.org> - 2011-10-19 04:48 +0100
    Re: A freshman's question whl <wanghailunmail@gmail.com> - 2011-10-19 00:54 -0700
      Re: A freshman's question Patricia Shanahan <pats@acm.org> - 2011-10-19 09:20 +0100
        Re: A freshman's question whl <wanghailunmail@gmail.com> - 2011-10-19 03:38 -0700
          Re: A freshman's question Lars Enderin <lars.enderin@telia.com> - 2011-10-19 17:48 +0200
            Re: A freshman's question Tim Slattery <Slattery_T@bls.gov> - 2011-10-19 12:24 -0400
              Re: A freshman's question whl <wanghailunmail@gmail.com> - 2011-10-20 03:55 -0700
            Re: A freshman's question whl <wanghailunmail@gmail.com> - 2011-10-20 03:50 -0700
          Re: A freshman's question Lew <lewbloch@gmail.com> - 2011-10-19 09:58 -0700
            Re: A freshman's question Patricia Shanahan <pats@acm.org> - 2011-10-19 18:47 +0100
            Re: A freshman's question whl <wanghailunmail@gmail.com> - 2011-10-20 03:48 -0700
        Re: A freshman's question whl <wanghailunmail@gmail.com> - 2011-10-19 03:49 -0700
          Re: A freshman's question Patricia Shanahan <pats@acm.org> - 2011-10-19 18:58 +0100
            Re: A freshman's question whl <wanghailunmail@gmail.com> - 2011-10-20 02:13 -0700
      Re: A freshman's question Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-10-19 06:05 -0300
        Re: A freshman's question whl <wanghailunmail@gmail.com> - 2011-10-19 03:38 -0700
    Re: A freshman's question Travers Naran <tnaran@gmail.com> - 2011-10-20 07:30 -0700
      Re: A freshman's question Gene Wirchenko <genew@ocis.net> - 2011-10-20 10:08 -0700
        Re: A freshman's question Patricia Shanahan <pats@acm.org> - 2011-10-20 18:22 +0100
        Re: A freshman's question Lew <lewbloch@gmail.com> - 2011-10-20 13:59 -0700
        Re: A freshman's question Joshua Cranmer <Pidgeot18@verizon.invalid> - 2011-10-20 17:38 -0500
  Re: A freshman's question Roedy Green <see_website@mindprod.com.invalid> - 2011-10-19 23:56 -0700
    Re: A freshman's question whl <wanghailunmail@gmail.com> - 2011-10-20 03:55 -0700

csiph-web