Why the value of "I" do not change?I=0;I=I++;System.out.println("I : "+I);this print statement gives value of I as zero, why so?

Questions by badkasys   answers by badkasys

Showing Answers 1 - 1 of 1 Answers

I=0; // Asigns 0 to variable I

I = I++ // I++ is post increment, means it increment the value of I to One (1) but returns the original value i.e. 0 ( Zero ). And now this 0 is again assigned to I. Setting I value 0 ( Zero )

At the end value of variable I is 0

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions