Quantcast
Channel: Java not reading "&&" statements properly? - Stack Overflow
Viewing all articles
Browse latest Browse all 4

Answer by Kruti Patel for Java not reading "&&" statements properly?

$
0
0
1 % 2 == 12 % 2 == 0-2 % 2 == 0-1 % 2 == -1

Here, -1%2 does not results in 1. Hence, it will not increment value of negodd variable.

In JAVA, negative number modulo will give same result as positive number modulo but with a negative sign. 0 is neutral thus it will not have any sign.


Viewing all articles
Browse latest Browse all 4

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>