Demo03.java 576 B

12345678910111213141516171819
  1. package com.loveCoding.j20250426_java_basic;
  2. /**
  3. * @author WanJl
  4. * @version 1.0
  5. * @title Demo03
  6. * @description
  7. * @create 2025/4/26
  8. */
  9. public class Demo03 {
  10. public static void main(String[] args) {
  11. //++ -- 都属于单目运算符,因为操作的数只有一个。
  12. //符号放在操作数前和操作数后,操作的顺序和步骤是不一样的。
  13. int a=1;
  14. System.out.println(a++); //先做其他运算,再做+1运算。
  15. int b=1;
  16. System.out.println(++b); //先做+1运算,再做其他运算。
  17. }
  18. }