452-JavaSE进阶通过常量获取最大值和最小值

  • 这个包装类有最大值和最小值的方法
    • 通过帮助文档查询一下
package com.bjpowernode.javase1.integer1;

public class IntegerTest04 {
    public static void main(String[] args) {
        /*通过常量获取最大值和最小值*/
        System.out.println("int的最大值:" + Integer.MAX_VALUE);
        System.out.println("int的最小值:" + Integer.MIN_VALUE);
        System.out.println("byte的最大值:" + Byte.MAX_VALUE);
        System.out.println("byte的最小值:" + Byte.MIN_VALUE);
        /* 包装类.MAX_VALUE/MIN_VALUE 是 Class Integer中的一个使用*/

    }
}

输出:
int的最大值:2147483647
int的最小值:-2147483648
byte的最大值:127
byte的最小值:-128

进程已结束,退出代码 0
posted @ 2020-10-26 08:36  nkndlawn  阅读(180)  评论(0)    收藏  举报