Pages

What is different between i++ and ++i

I want to share with you about different between i++ and ++i.

++i
**********
int i=0;
System.out.println(++i);
**********
It will print on screen 1


i++
**********
int i=0;
System.out.println(i++);
**********
It will print on screen 0

Answer :
++i will add current i value with 1 before print


i++ will add current i value with 1 after print
Related Posts Plugin for WordPress, Blogger...