public class
Test {
public static void main(
String[] a)
{
float f = Float.POSITIVE_INFINITY;
byte b = (byte)f;
int i = (int)f;
short s = (short)f;
System.out.println(b);
System.out.println(s);
System.out.println(i);
System.out.println(f);
double d = Double.POSITIVE_INFINITY;
long l = (long)d;
int j = (int)d;
System.out.println(l);
System.out.println(j);
}
}
------------------ output ------------------
-1
-1
2147483647
Infinity
9223372036854775807
2147483647
---------------------------------------------
i was expecting -2147483648 for the last SOP. anyone please explain.