+ 6
What is different between ++x and x++??
18 Respuestas
+ 4
++x is prefix and x++ is postfix.
++x increments before use & x++ increments after using the variable.
+ 9
Thank you Luna Akira JavaGoal.com Codebeast** Alex Kuriakose devendra soni Toyosi Mathew Leandro Fernandes Mägår 5ãm Akå Tröjän 🅰🅹 - ɪ'ᴍ ᴄʀɪᴍɪɴᴀʟʟʏ ɢᴏᴏᴅ! and others for helping me🤗
+ 6
The different is in result and print??
+ 6
Thank you
+ 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
+ 5
Thank you Luna Akira
+ 4
https://www.sololearn.com
/discuss/56740/?ref=app
https://www.sololearn.com/discuss/1556/?ref=app
https://www.sololearn.com/discuss/232340/?ref=app
https://www.sololearn.com/discuss/96907/?ref=app
https://www.sololearn.com/discuss/2025205/?ref=app
Maybe you can look this to learn about it👍
+ 2
Before ask try to find using search option. So many time asked by people.
https://www.sololearn.com/Discuss/2025205/?ref=app
https://www.sololearn.com/Discuss/1967494/?ref=app
https://www.sololearn.com/Discuss/1117133/?ref=app
https://www.sololearn.com/Discuss/645027/?ref=app
+ 2
Saiful Sajis , Mystic Life Already explained to you.
+ 2
x ++ increments after using the variable.
++x increments before use.
+ 2
++x uses its value before incrementing while x++ uses the value after incrementing
+ 2
++x means increment x before reassigning it to x, x++ means reassign x to x,before incrementing x
+ 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
+ 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
0
Leandro Fernandes perfect definition 👍👍
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
0
++x means add 1 before going to loop and x++ means to add 1 after one time execution is done in loop