What is deference between postincrement and preincrement | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is deference between postincrement and preincrement

17th Aug 2017, 2:27 AM
YARAMATI GOPALA KRISHNA
YARAMATI GOPALA KRISHNA - avatar
3 Answers
17th Aug 2017, 3:23 AM
Hatsy Rei
Hatsy Rei - avatar
+ 4
There are lots of answers on this in the Q & A, at least do little search before posting. Happy coding!
17th Aug 2017, 4:15 AM
Benneth Yankey
Benneth Yankey - avatar
+ 2
preincrement evaluates before the expression while postincrement evaluates only after the expression. for example, given a=1, system.out.println(++a) outputs 2 (first increment, then print the value), while system.out.println(a++) outputs 1 (first display, then increment the value of a)
17th Aug 2017, 4:01 AM
Jeanderson Candido
Jeanderson Candido - avatar