<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>passbyreference &amp;mdash;   christova  </title>
    <link>https://christova.writeas.com/tag:passbyreference</link>
    <description>&lt;b&gt;&lt;h3&gt;Tech Articles&lt;/h3&gt;&lt;/b&gt;&lt;br/&gt;&lt;b&gt;Collated from various sources. Full copyright remains with original authors.&lt;/b&gt;</description>
    <pubDate>Wed, 06 May 2026 03:42:26 +0000</pubDate>
    <item>
      <title>Pass by Reference &amp; Pass by Value</title>
      <link>https://christova.writeas.com/pass-by-reference-and-pass-by-value?pk_campaign=rss-feed</link>
      <description>&lt;![CDATA[No alternative text description for this image&#xA;&#xA;In Java, everything is passed by value, including object references. When you pass an object x to a method, you are passing a copy of the reference to the object, not the actual object itself. This means:&#xA;&#xA;1\. If you modify the object via the reference (e.g., x.setName(&#34;newName&#34;);), the changes will affect the original object because both the original reference and the copied reference point to the same object in memory.&#xA;&#xA;2\. If you reassign the reference inside the method (e.g., x = y;), the reassignment only affects the copy of the reference. The original reference outside the method remains unchanged.&#xA;&#xA;#PassByReference #PassByValue]]&gt;</description>
      <content:encoded><![CDATA[<p><img src="https://media.licdn.com/dms/image/v2/D4E10AQHZbWlvZMGlVw/image-shrink_800/image-shrink_800/0/1736518349810?e=1737298800&amp;v=beta&amp;t=-H4vYNwqKYA28Ot_yELSmZOV_o7TZLgkSESJkRJJbQA" alt="No alternative text description for this image"/></p>

<p>In Java, everything is passed by value, including object references. When you pass an object x to a method, you are passing a copy of the reference to the object, not the actual object itself. This means:</p>

<p>1. If you modify the object via the reference (e.g., x.setName(“newName”);), the changes will affect the original object because both the original reference and the copied reference point to the same object in memory.</p>

<p>2. If you reassign the reference inside the method (e.g., x = y;), the reassignment only affects the copy of the reference. The original reference outside the method remains unchanged.</p>

<p><a href="https://christova.writeas.com/tag:PassByReference" class="hashtag"><span>#</span><span class="p-category">PassByReference</span></a> <a href="https://christova.writeas.com/tag:PassByValue" class="hashtag"><span>#</span><span class="p-category">PassByValue</span></a></p>
]]></content:encoded>
      <guid>https://christova.writeas.com/pass-by-reference-and-pass-by-value</guid>
      <pubDate>Sun, 12 Jan 2025 15:02:17 +0000</pubDate>
    </item>
  </channel>
</rss>