English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
To get the minimum value of the int data type in Java, use the following command-
Integer.MIN_VALUE
To get the maximum value of the int data type in Java, use the following command-
Integer.MAX_VALUE
Now let's implement this in the example.
public class Demo { public static void main(String[] args) { int val1 = 20; int val2 = 3000; System.out.println("Value1: \+val1); System.out.println("Value2: \+val2); System.out.println("Maximum value: ");+Integer.MIN_VALUE); System.out.println("Minimum value: ");+Integer.MAX_VALUE); } }
Output result
Value1: 20 Value2: 3000 Maximum value: -2147483648 Minimum value: 2147483647