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