public class Puls{
public static void main (String[] args) {
int a = 10;
int b = a ++; \\ 先赋值再自加
int c = ++ a; \\先自加再赋值
System.out.println(a);
System.out.println(b);
System.out.println(c);
}
}
得出a=12,b=10,c=12
public class Puls{
public static void main (String[] args) {
int a = 10;
int b = a ++; \\ 先赋值再自加
int c = ++ a; \\先自加再赋值
System.out.println(a);
System.out.println(b);
System.out.println(c);
}
}
得出a=12,b=10,c=12