Path: csiph.com!news.mixmin.net!aioe.org!LeVffQP25j5GAigzc2gaQA.user.46.165.242.75.POSTED!not-for-mail From: =?UTF-8?Q?Arne_Vajh=c3=b8j?= Newsgroups: comp.lang.java.programmer Subject: Re: How do I dereference a static string Date: Thu, 3 Nov 2022 19:29:49 -0400 Organization: Aioe.org NNTP Server Message-ID: References: <282053db-e7b9-4f0a-a66c-12f53021fd55n@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: gioia.aioe.org; logging-data="23851"; posting-host="LeVffQP25j5GAigzc2gaQA.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org"; User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.4.1 X-Notice: Filtered by postfilter v. 0.9.2 Content-Language: en-US Xref: csiph.com comp.lang.java.programmer:39835 On 11/3/2022 1:05 PM, C.D. Altenburg, Ph.D, wrote: > Say I have the string > > public static string foo = "foo"; > > can I just do > > foo = null; > > in order to dereference that string? It is a valid statement. But note that Java does not use reference counting for memory management so setting references to null when "done" is very rare in Java (doing it when "ready" is seen). Arne