存在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

 


  

 

  

来一道刷了进BAT的面试题?

posted @ 2019-11-16 11:29  ConstXiong  阅读(1498)  评论(0编辑  收藏  举报