DEV Community

CoderEthanLiu
CoderEthanLiu

Posted on

Java

不同类型的整数一起运算,小类型需要转换为大类型,short、byte、char一律转换为int再进行计算(无论算式中有无int,都需要转换),结果也是int;如果算式中出现了long类型,那么全部都需要转换到long类型再进行计算,结果也是long,反正就是依大的来。

字符串不仅可以跟字符串拼接,也可以跟基本数据类型拼接

Top comments (0)