本文介绍了通过引用传递和通过引用调用之间的区别是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在java中通过引用传递和通过引用调用有什么区别?
what is the difference between pass by reference and call by reference in java ?
推荐答案
Java不会通过引用传递任何变量。
Java does not pass any variables by reference.
考虑通过Java引用传递的对象很有诱惑力但是很有害。对象类型的变量是引用。传递时,它们按值传递。
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.
编辑:现有stackoverflow问题中提供了更多详细信息(Spoiler:No。)
More detail is provided in the existing stackoverflow question "Is Java pass by reference?" (Spoiler: No.)
这篇关于通过引用传递和通过引用调用之间的区别是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!