2.运算符

     +的用法

a:加法
b:正号
c:字符串连接符

+=隐含了自动强制转换。

 

    short a=1;

     a+=a;

     System.out.println(a);    //2,  a是int类型


    short b=1;

     b=b+1;                    //报错,精度可能会损失,b+1时强制转换为int

     System.out.println(b);    

 

 

原文地址:https://www.cnblogs.com/bushi/p/6515309.html