码迷,mamicode.com
首页 > 其他好文 > 详细

物极必反

时间:2018-11-10 20:08:16      阅读:171      评论:0      收藏:0      [点我收藏+]

标签:ati   public   stat   pre   max   []   main   long   ring   

物极必反

public class Test {
    public static void main(String[] args) {
        int a = Integer.MAX_VALUE;
        long b = a + 1;
        System.out.println(a); // 2147483647
        System.out.println(b); // 物极必反 -2147483648 溢出
    }
}

答案:
2147483647
-2147483648

物极必反

标签:ati   public   stat   pre   max   []   main   long   ring   

原文地址:https://www.cnblogs.com/hglibin/p/9940203.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!