+ 6

What is different between ++x and x++??

11th Dec 2019, 8:49 AM
Saiful Sajis
Saiful Sajis - avatar
18 Réponses
+ 4
++x is prefix and x++ is postfix. ++x increments before use & x++ increments after using the variable.
13th Dec 2019, 4:46 PM
Azhar Sajis
Azhar Sajis - avatar
+ 6
The different is in result and print??
11th Dec 2019, 11:03 AM
Saiful Sajis
Saiful Sajis - avatar
+ 6
Thank you
11th Dec 2019, 11:30 AM
Saiful Sajis
Saiful Sajis - avatar
+ 5
Its called prefix(++x)and postfix(x++). Prefix first increment the value and than use its value . Postfix first use the value and than increment it. Just like this int i=1; out.println(++x); //2 out.println(x++); //1
12th Dec 2019, 2:02 AM
0_O-[Mägár_Sám_Äkà_Nüllpøïntêr_Èxëcéptïön]~~
0_O-[Mägár_Sám_Äkà_Nüllpøïntêr_Èxëcéptïön]~~ - avatar
+ 5
Thank you Luna Akira
13th Dec 2019, 5:27 PM
Saiful Sajis
Saiful Sajis - avatar
+ 2
Saiful Sajis , Mystic Life Already explained to you.
11th Dec 2019, 11:14 AM
A͢J
A͢J - avatar
+ 2
x ++ increments after using the variable. ++x increments before use.
12th Dec 2019, 1:53 PM
Leandro F Moraes
Leandro F Moraes - avatar
+ 2
++x uses its value before incrementing while x++ uses the value after incrementing
13th Dec 2019, 6:20 AM
Alex Kuriakose
Alex Kuriakose - avatar
+ 2
++x means increment x before reassigning it to x, x++ means reassign x to x,before incrementing x
13th Dec 2019, 8:14 AM
Codebeast**
Codebeast** - avatar
+ 1
Let's say x=5 if you print ++x, result will be 6 if you print x++, result will be 5 and after print, x becomes 6
11th Dec 2019, 9:02 AM
Mystic Life
Mystic Life - avatar
+ 1
take x=1 ++x means pre increment,that means first you increment the value ,that value stored in the x. x++ means post increment,that means the value is 1,but after increments. ex: x=1 x++=1 ++x=3 x++=3 x++=4 ++x=6
15th Dec 2019, 1:39 PM
kota siva
0
Leandro Fernandes perfect definition 👍👍
12th Dec 2019, 10:36 PM
Toyosi Mathew
Toyosi Mathew - avatar
0
++x increments before using variable example x=3 Print result will be 4 X++ increments after using the variable Example x=3 Print will be 3and after print x becomes 4
12th Dec 2019, 11:13 PM
devendra soni
devendra soni - avatar
0
++x means add 1 before going to loop and x++ means to add 1 after one time execution is done in loop
15th Dec 2019, 6:58 AM
Pradhyuman