passing by reference in Java doubts

后端 未结 5 1791
借酒劲吻你
借酒劲吻你 2021-01-26 05:07

So I was reading this post and response no. 2. In that example, after calling that method, does the Dog value at address 42, name\'s changes to Max?

Dog myDog;

         


        
5条回答
  •  旧巷少年郎
    2021-01-26 05:25

    This is probably the topic that is confusing for most novice developers in Java. duffymo had already provided a detailed answer (I'm not going to repeat that) but I could give you some articles for reference that I hope would clear the doubt from your mind.

    Jon Skeet's article about parameter passing in Java
    Pass-by-Value Please
    Does Java pass by reference or pass by value?

    HTH.

提交回复
热议问题