Java运算符(细节)
时间:2021-02-26 13:17:42
收藏:0
阅读:0
public class Demo1 {
public static void main(String[] args) {
int a = 10;
int b = 20;
System.out.println(""+a+b);//输出的是1020
System.out.println(a+b+"");//输出的是30
byte c = 10;
//c = c+1;编译错误,Required type:byte,Provided:int
c +=1; //相当于c=(byte)(c+1)
System.out.println(c);//输出的是11
}
}
评论(0)