About Java McQ
How print(++x = x++) is false It should be the same result? Doesn’t it?
No, assuming <x> is a number, ++x doesn't equal x++ because these operators have different way of working ++x increments in-place (immediately) x++ increments after the current line has been evaluated by Java compiler For less confusion in reading a code, it is NOT recommended to mix the use of these operators in a single line of code, the code looks more of a riddle than an actual code when it's being written that way.
Mustakim Rahman int x = 7 x++ == ++x; In this case result would false because of (x++) x++ = 7 but after increment x would be 8 but ++x here is preincrement so ++x = 9 because x was already 8
Mustakim Rahman int x = 7; ++x = 8 and x++ = 7; but in this case ++x == x++;. after increment of x (++x) , x++ would be 8 so 8 == 8 true System.out.println (++x==x++) = true
Yes brother i just forget to text properly, (++x == ++x) … Sometimes in the mcq part wrong answere are the correct answere. Very Frustrating!
Ipang Suppose int x=7; x++; or ++x; What would be the output? 7 or 8?
Mustakim Rahman Paste this inside a class' main method, I think you'll understand the difference afterwards int x = 7; System.out.println("x++ = " + x++); System.out.println("After line evaluation <x> = " + x); x = 7; // reset <x> value to start over System.out.println("\n++x = " + ++x); System.out.println("After line evaluation <x> = " + x);
What's wrong? :(
Why won't my image display
I have made a calculator in which my % (Percentage) not work correctly for 100%50 or 100%20.
How the answer is 50?
Number of Ones ( C++ ) question!