Article View: borland.public.jbuilder.java.language
Article #16357Re: Operator precedence
From: Tor Iver Wilhelmsen
Date: Wed, 03 Mar 1999 00:00
Date: Wed, 03 Mar 1999 00:00
35 lines
1254 bytes
1254 bytes
"MM" <manu_mathew@geocities.com> writes: > The output is: > > 0 1 > 0 2 > 0 3 > 0 4 > 0 5 > 0 6 > 0 7 > 0 8 > 0 9 > > Why so? Um, because you set the cell, then increment i: When it comes to the print statement, it prints an array cell you haven't set yet, and which has a default value of 0. The first run of your loop is equivalent to: arr[0] == 1; System.out.println(arr[1] + " " + 1); > As a side issue what it wrong with : > ++i++; > where i is an int? You cannot increment an increment expression: That is, "++i++" is either equivalent to "(++i)++" or "++(i++)", neither of which make sense. Think of it: If i is 0 to begin with, the expression evaluates to either "1++" or "++0", neither of which are legal.
Technical Details
Message-ID:
<uogmatwur.fsf@sds.no>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<7bjhbh$23j5@forums.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,5de188e6c0bc95e3 X-Google-Attributes: gidf74b3,public From: Tor Iver Wilhelmsen <tor.wilhelmsen@sds.no> Subject: Re: Operator precedence Date: 1999/03/03 Message-ID: <uogmatwur.fsf@sds.no> X-Deja-AN: 450785239 Sender: towi@SDSA1761 References: <7bjhbh$23j5@forums.borland.com> Supersedes: <upv6qtwvl.fsf@sds.no> Organization: Another Netscape Collabra Server User Newsgroups: borland.public.jbuilder.java.language