Demo02-数组转换-变量


package operator;

public class Demo02 {
    public static void main(String[] args) {
        long a =123123311231231L;
        int b =123;
        short c =10;
        byte d =8;
        System.out.println(a + b + c + d); //Long 所有的数组 有一个为long 结果都为long
        System.out.println(b + c+ d); //Int 没有long的时候结果都为Int
        System.out.println(c + d); //Int 没有long的时候结果都为Int
        System.out.println( (double) c + d); //double 如果有一个数为double 结果都为double
    }
}

 

posted @ 2022-02-21 16:20  苏三说v  阅读(14)  评论(0编辑  收藏  举报