xxxxxxxxxx
int maxValue = Integer.MAX_VALUE;
System.out.println("The maximum value of int in Java is: " + maxValue);
xxxxxxxxxx
Integer.MAX_VALUE //== 2147483647, once you increment past that, you
//"wrap around" to Integer.MIN_VALUE
xxxxxxxxxx
public class Test
{
public static void main(String[] args)
{
System.out.println(Integer.MIN_VALUE);
System.out.println(Integer.MAX_VALUE);
System.out.println(Integer.MIN_VALUE - 1);
System.out.println(Integer.MAX_VALUE + 1);
}
}
xxxxxxxxxx
(stores the maximum possible value for any integer variable)
public static void main(String[] arg)
{
System.out.println("Integer.MAX_VALUE = "
+ Integer.MAX_VALUE);///output :-2147483647
}
}
Any integer variable cannot store any value beyond this limit
xxxxxxxxxx
int a = 3;
int b = 6;
System.out.println(Math.max(a, b));// will print 6