I have this piece of code: class Test { public static void main(String s[]) { int a = 1;
a = 2 + a + a++ + 3; System.out.println(a); a = 1; a = 2 + a++ + 3 + a; System.out.println(a); }}
The output is: 7 8
Shouldn't the values be equal? I thought that values for all variables are first retreive. Then the unary operators are applied. Then lastly, the binary operators are applied from left to right. Please help.
Please revise your display name to meet the JavaRanch Naming Policy. To maintain the friendly atmosphere here at the ranch, we like folks to use real (or at least real-looking) names.
You can edit your display name here. Thank you for your prompt attention!
-Marc
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer sscce.org
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.