How to do call by reference in Java?

前端 未结 12 642
悲&欢浪女
悲&欢浪女 2021-01-30 17:36

Since Java doesnt support pointers, How is it possible to call a function by reference in Java like we do in C and C++??

12条回答
  •  [愿得一人]
    2021-01-30 18:06

    http://www.javaworld.com/javaqa/2000-05/03-qa-0526-pass.html

    Java does manipulate objects by reference, and all object variables are references. However, Java doesn't pass method arguments by reference; it passes them by value.

提交回复
热议问题