非常感谢楼主分享,
我此前理解为,
例子:
public class TestOperator {
public static void main(String[] args){
double d = 10.2%3;
System.out.println(d);
int a = 3;
int b = a++; //执行完后,b=3。先给b赋值,再自增。(int b=a++;//执行完后,B=3,再++,b=5)
int c = ++a; //执行完后,c=5。先自增,再给b赋值
System.out.println(a); //执行完后,a=5(a自增了两次) (a=3,a不变)
System.out.println(b); //执行完后,b=3
System.out.println(c); //执行完后,c=5
}
}
:loveliness: |