Hi!
When I compile the following code I get the value as 1
public static void main(
String[ ] args)
{
int k=0;
k += ++k;
System.out.println(k);
}
As per my understanding, bec's of operator precedence k becpomes 1 first and now k holds the value of 1 and then when we say k+=1 which is k=k+1(1+1) is 2.Why is it giving 1?Can anybody please explain.Thanks
[ May 18, 2004: Message edited by: Barry Gaunt ]