A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Refactoring for Software Design Smells: Managing Technical Debt
this week in the
OO, Patterns, UML and Refactoring
Programmer Certification (SCJP/OCPJP)
Q. on G.C
Joined: Feb 25, 2002
Mar 26, 2002 10:50:00
s1 = "hello";
String s2 = "Pal";
s1 = s1+s2;// #5
Here after line #5 ,hello string get eligible for g.c, or never string literals get garbage collected?
2)Is it true that static and native members never get g.cted?
Joined: Mar 26, 2002
Mar 26, 2002 11:20:00
I'm not completely sure, but I thought that only methods (and not member variables) could be declared with the native modifier?
Fun programming etcetera!
Joined: Mar 14, 2002
Mar 26, 2002 16:53:00
I think "Hello" is eligible for gc after # 5 because since string s1 now refers to different string "hello" is left without any reference so it is eligible or gc.
Joined: Feb 24, 2002
Mar 26, 2002 18:39:00
You can get information about garbage collection of String literals in this discussion:
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: Q. on G.C
how can you modify a String?
Guarenteeing G.C part
How many String Object are created in the following code ??
String replace method
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015