| Author |
increment operators
|
Angela lewis
Ranch Hand
Joined: Mar 01, 2004
Posts: 100
|
|
I fail to understand the 2 + signs before k in 1.
|
 |
Shilpi M Ag
Ranch Hand
Joined: May 07, 2004
Posts: 40
|
|
You can very well remove one of the +.. It is there to confuse us.. and simply means that k is positive. You can change it to the following to see the difference
|
 |
black night
Greenhorn
Joined: Jun 18, 2004
Posts: 5
|
|
hi angeela i am totally agree with silpi , its only to cofuse , + + or even hundred + means the same one + . Here first + for addition and second + for sign notation code: public class TestClass { public static void main (String args[ ] ) { int k = 1; int i = ++k + k++ + + k ; System.out.print(i+ " "+ k) ; } } /* ++k = 1 + 1 =2 k++ = 2+1=3 +k = +3 i = ++k(2) + k++(2) + +k(3); i = 2 + 2 + 3 = 7 */ The solution might be confusing.If is there any mistake then please tell me . cia
|
 |
 |
|
|
subject: increment operators
|
|
|