package operator;
public class Demo04 {
public static void main(String[] args) {
//++ -- 自增,直减 一元运算符
int a = 3;
int b = a++;//执行完这行代码后,先给b赋值,再自增
//a = a + 1;
System.out.println(a);
//a++ a = a + 1;
int c = ++a;//执行完这行代码前,先自增,再给b赋值
System.out.println(a);
System.out.println(b);
System.out.println(c);
}
}
自增自减
最新推荐文章于 2021-05-18 07:53:57 发布