在Java中,++是一個一元操作符,它用于將操作數(變量)的值增加1。有兩種形式:
++
這是一個簡單的例子:
int a = 5; int b = ++a; // a的值變為6,b的值也為6 int c = a++; // a的值變為7,c的值為6