In Java, -1001
is not considered a valid integer literal. Why?
There is no such thing as a negative decimal literal in Java; see JLS§3.10.1.
-1001 is an compile time evaluable constant expression consisting of a unary negation of the literal 1001.
(The same applies to C and C++).
The number -1001 is valid Integer literal in java 7 and above.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With