Article View: borland.public.jbuilder.java.language
Article #16355Operator precedence
From: MM
Date: Wed, 03 Mar 1999 00:00
Date: Wed, 03 Mar 1999 00:00
40 lines
967 bytes
967 bytes
Check this out:
<code>
public class Someclass {
public static void main(String[] args){
int i=0;
int[] arr = new int[10];
while(true){
if(i==9) break;
arr[i] = ++i;
System.out.println(arr[i] + " " + i);
}
}
}
</code>
The output is:
0 1
0 2
0 3
0 4
0 5
0 6
0 7
0 8
0 9
Why so?
As a side issue what it wrong with :
++i++;
where i is an int?
Thanks
-MM
Technical Details
Message-ID:
<7bjhbh$23j5@forums.borland.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,5de188e6c0bc95e3,start X-Google-Attributes: gidf74b3,public From: "MM" <manu_mathew@geocities.com> Subject: Operator precedence Date: 1999/03/03 Message-ID: <7bjhbh$23j5@forums.borland.com> X-Deja-AN: 450763440 X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.0810.800 Organization: Another Netscape Collabra Server User X-MSMail-Priority: Normal Newsgroups: borland.public.jbuilder.java.language