public class TestMain {

    public static void main(String[] args) {
        Integer integer = 2;
        go(2);
        System.out.println(integer);
    }

    private static void go(Integer integer) {
        integer = 3; // 相当于int 3 封装了一个新的Integer: =new Integer(3); 自动装箱
        integer = new Integer(4);
    }
}

输入为:2

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-05-25
  • 2022-01-11
  • 2021-07-11
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-12-27
  • 2021-08-24
  • 2022-12-23
  • 2022-12-23
  • 2021-07-26
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案