public class IntRangeExample {
public static void main(String[] args) {
// Java 中 int 类型的数值范围是从 -2^31 到 2^31 - 1
int minValue = Integer.MIN_VALUE; // -2147483648
int maxValue = Integer.MAX_VALUE; // 2147483647
System.out.println("int 的最小值: " + minValue);
System.out.println("int 的最大值: " + maxValue);
}
}
int
是 Java 中的一种基本数据类型,占用 32 位(4 字节)。Integer.MIN_VALUE
表示 int
类型的最小值,即 -2^31
或 -2147483648
。Integer.MAX_VALUE
表示 int
类型的最大值,即 2^31 - 1
或 2147483647
。System.out.println
输出了 int
类型的最小值和最大值。上一篇:java获取项目根目录路径
下一篇:java service
Laravel PHP 深圳智简公司。版权所有©2023-2043 LaravelPHP 粤ICP备2021048745号-3
Laravel 中文站