public class Test2 {
public static void main(String[] args) {
int a =0;
int b =1;
System.out.println(a++);
int c = a+b;
System.out.println("c="+c);
System.out.println("a="+a);
System.out.println("----------------------------------");
System.out.println(++a);
int d = a+b;
System.out.println(d);
}
public static void main(String[] args) {
int a =0;
int b =1;
System.out.println(a++);
int c = a+b;
System.out.println("c="+c);
System.out.println("a="+a);
System.out.println("----------------------------------");
System.out.println(++a);
int d = a+b;
System.out.println(d);
}
}
输出结果如下:
0
c=2
a=1
----------------------------------
2