+ 2
Why the output is 1 why don't it shows 0 as it's output?
4 Answers
+ 16
++x gives ++0 ie 1
plus
--x gives --1 ie 0
1+0 is 1
Alternatively you can go like this
a=++x. //1
b=--x. //0
Output.. a+b //1+0=1
Most probably it goes like this only..
+ 8
Keep in mind what @Rrestoring faith said. There is no single way to determine the output, because compilers and compilers differ and may produce different results, even in one language.
+ 7
Java works with these a little differently from C++ if that's what's causing your confusion. In C++ this code would give 0. In Java, what @Frost said.
+ 1
Thank you