package raky.train;
/**
* i++ /i-- 先取值,后计算
* ++i /--i 先计算,后取值
*
* @author raky
*
*/
public class Test7 {
public static void main(String[] args) {
int i = 10;
// System.out.println(i++); //10
// System.out.println(i); //11
// System.out.println(i--); //10
// System.out.println(i); //9
// System.out.println(++i); //11
// System.out.println(i); //11
System.out.println(--i); //9
System.out.println(++i); //10
System.out.println(i--); //10
System.out.println(++i); //10
System.out.println(i++); //10
System.out.println(i); //11
}
}
自增/自减
最新推荐文章于 2023-08-03 19:53:11 发布