what is the difference between pass by reference and call by reference?

后端 未结 3 746
予麋鹿
予麋鹿 2021-01-02 15:05

what is the difference between pass by reference and call by reference in java ?

3条回答
  •  抹茶落季
    2021-01-02 16:07

    Java does not pass any variables by reference.

    It is tempting to think of objects being passed by reference in Java -- but harmful. Variables of object type are references. When passed, they are passed by value.

    In other languages, pass-by-reference and call-by-reference are the same thing.

    Edit: More detail is provided in the existing stackoverflow question "Is Java pass by reference?" (Spoiler: No.)

提交回复
热议问题