-2^31 will give the value -2147483648 but when we multiply or assign n=-n it does not work out, any specific reason in JAVA?
Asked
Active
Viewed 36 times
0
-
1*does not work out* - what did you mean. Show us your code. – Scary Wombat Jul 17 '20 at 04:52
-
Or this? [Math.abs returns wrong value for Integer.Min_VALUE](https://stackoverflow.com/q/5444611/7509065) – Joseph Sible-Reinstate Monica Jul 17 '20 at 04:53
-
public static void main(String[] args) { int n=-2147483648; System.out.println((-1*-2147483648)); } – Ashwini Jha Jul 17 '20 at 04:54
-
@JosephSible-ReinstateMonica Understood – Ashwini Jha Jul 17 '20 at 04:57