循环的边界溢出

来源:互联网 发布:win7 64位优化版下载 编辑:程序博客网 时间:2024/06/07 06:21
public class OverflowLoop{    public static final int END =Integer.MAX_VALUE;    public static final int START = END -100;    public static void main(String[] args) {        int j=0;        for (int i=START;i<=END;i++){            j++;        }        System.out.println(j);    }}int i 在最后溢出了,不过Intellij IDEA 不知道咋搞的,这个运行变成了System.in。
0 0
原创粉丝点击