编程语言
首页 > 编程语言> > [JAVA]数字分割

[JAVA]数字分割

作者:互联网

/*

██╗     ███████╗ ██████╗     ███████╗██╗  ██╗██╗
██║     ██╔════╝██╔═══██╗    ██╔════╝██║  ██║██║
██║     █████╗  ██║   ██║    ███████╗███████║██║
██║     ██╔══╝  ██║   ██║    ╚════██║██╔══██║██║
███████╗███████╗╚██████╔╝    ███████║██║  ██║██║
╚══════╝╚══════╝ ╚═════╝     ╚══════╝╚═╝  ╚═╝╚═╝

数字分割

*/
public class Demo06 {
    public static void main(String[] args) {
        int money = 10_0000_0000;
        System.out.println(money);

        int years=20;
        int total = money*years;
        System.out.println(total); //-1474836480 内存溢出
        long total2 = money*((long)years);
        System.out.println(total2); //先把一个数据转换为long
    }
}

标签:分割,JAVA,数字,int,money,System,long,years,out
来源: https://www.cnblogs.com/leoshi/p/16264724.html