[Logo]
Forums Register Login
increment operation-weird result
class test
{
public static void main(String args[])
{
int i=5;
for(int j=0;j<10;j++)
{
i=i++;
System.out.println(i);

}
}
}


output :
5
5
5
5
5
5
5
5
5
5



why the output is not 6,7,8....15

plz explain
This exact issue is actually discussed in the JavaRanch FAQ.

Henry
Beware the other head of science - it bites! Nibble on this message:
Rocket Oven Kickstarter - from the trailboss
https://coderanch.com/t/695773/Rocket-Oven-Kickstarter-trailboss


This thread has been viewed 435 times.

All times above are in ranch (not your local) time.
The current ranch time is
Jul 16, 2018 12:37:49.