Junior — Middle
What is the range of values that the int data type can take?
sobes.tech AI
Answer from AI
In Java, the data type int occupies 4 bytes (32 bits) and stores signed integers. The range of int values is from -2,147,483,648 to 2,147,483,647 inclusive, that is from -2^31 to 2^31 - 1.
Example usage:
int a = 100;
int b = -5000;
int max = Integer.MAX_VALUE; // 2147483647
int min = Integer.MIN_VALUE; // -2147483648