# Comment on Tutorial - Increment and Decrement Operator By aathishankaran

Comment Added at : 2012-02-16 16:52:05

Comment on Tutorial : Increment and Decrement Operator By aathishankaran
```Answer for Comment 4 : " n=n++ ; " is a useless line !! it doesn't do anything. what's actually happening there is, that the value of n was assigned 0, So, when you run the loop the value of n++ gets stored in n (as we had n=n++) which is 0 (as a post increment operator first reads the value then increments 1to it). So the value of n++ is 0 which is being stored by n . *output comes 0 for the first loop and as following by all other loops output is 0 till the end* In simple way !! int n=0; for(int m=0 ; m<5 ; m++){ n=n++ //n++ == 0 at this time so, n becomes 0 } To avoid this useless thing instead of using n=n++; use n++; //This would add 1 in each loop :) Thank you . I hope now you don't have any doubt on "n=n++;" ;)```

View Tutorial

#### Related Tutorials

1. You do not give an example on fillratio i want to
View Tutorial          By: reguieg at 2015-08-23 20:53:50

2. hi .the program does run thank you for that ,i nee
View Tutorial          By: mazen at 2008-09-09 04:55:16

3. thanks alot steven for the code. i'm try to automa
View Tutorial          By: Roger at 2011-05-17 17:33:07

4. hi all,

i successfully executed the

View Tutorial          By: praveen at 2010-07-14 04:47:41

5. thanks for sharing.It's Easy to Understand
View Tutorial          By: Ganesh Abothula at 2013-01-23 10:43:55

6. Why this exception at run time?

Fri

View Tutorial          By: Sebin Joseph at 2011-04-01 06:03:17

7. not good example to learn the overriding methods
View Tutorial          By: george at 2010-04-25 12:08:20

8. HI,
I want to send an sms via website to mo

View Tutorial          By: Hemant at 2008-11-04 05:26:30

9. i m new in java plz send package of simple program
View Tutorial          By: iqbal ahmad at 2009-09-07 01:26:41

10. This one is helpful. Thanks

Is th

View Tutorial          By: Umesh Aawte at 2009-06-23 06:43:55