提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
Java增量运算符++将其操作数的值增加一,而减量运算符-将其操作数的值减少一。
public class Main {/** from 时 代 Java - nowjava.com**/ public static void main(String[] args) { int i = 10; int j = 10; i++; j++; System.out.println("i = " + i); System.out.println("j = " + j); /* * value of i would be assigned to k and then its * incremented by one. */ int k = i++; /* * value of j would be incremented first and then * assigned to k. */ /* *来 自 NowJava.com - 时 代 Java */ int l = ++j;