提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
前缀增量和后缀增量运算符。
public class Main /*from N o w J a v a . c o m*/ { public static void main(String[] args) { // demonstrate postfix increment operator int c = 5; System.out.printf("c before postincrement: %d%n", c); // prints 5 System.out.printf(" postincrementing c: %d%n", c++); // prints 5 System.out.printf(" c after postincrement: %d%n", c); // prints 6 System.out.println(); // skip a line // demonstrate prefix increment operator c = 5; System.out.printf(" c before preincrement: %d%n", c); // prints 5 System.out.printf(