Although I am not new to java, I observed this peculiar behavior the other day. I was refreshing my basics by running code consisting of basic arithmetic operations. Now according to java (and basic rules of arithmetic's ofcourse) , -ve * -ve
OR -ve / -ve
is a +ve
number.
But compiling this source:-
int b = Integer.MIN_VALUE / -1;
System.out.println("b: " + b);
Gives me output:-
b: -2147483648
Which is -ve
, Can anyone point me whats wrong? I know it must be small thing that I cant notice.