Junior
What are the minimum and maximum values of the integer data type in Java?
sobes.tech AI
Answer from AI
The minimum value of Integer.MIN_VALUE is -2^31 (-2,147,483,648).
The maximum value of Integer.MAX_VALUE is 2^31 - 1 (2,147,483,647).
These values are determined by the fact that the int type in Java is a 32-bit signed primitive data type.
// Constants holding the minimum and maximum int values
int minValue = Integer.MIN_VALUE;
int maxValue = Integer.MAX_VALUE;
// Outputting the values
// System.out.println("Minimum int value: " + minValue);
// System.out.println("Maximum int value: " + maxValue);