存在i+1< i的数吗?为什么?

存在,如 Integer.MAX_VALUE

package constxiong.interview;

/**
 * 测试最大值加1
 * @author ConstXiong
 */
public class TestMaxValueAddOne {

    public static void main(String[] args) {
        int i = Integer.MAX_VALUE;
        System.out.println(i+1<i);
        System.out.println(i+1);
    }
    
}

打印

true
-2147483648


 


 

所有资源资源汇总于公众号


 

猜你喜欢

转载自www.cnblogs.com/ConstXiong/p/11871154.html