A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Programmer Certification (SCJP/OCPJP)
Constant String Pool
Joined: May 01, 2006
May 09, 2006 07:05:00
When we create a
Then what happen actually is a String Object is created on Constant String Pool or Object is created on heap as any other object and Constant String Pool contain only reference of that object crrated.
SCJP 1.4 (93%)<br />SCBCD 5 (96%)
Joined: Feb 02, 2006
May 09, 2006 07:15:00
Joined: Jan 14, 2006
May 09, 2006 07:17:00
Hello Pavan ,
Welcome to Javaranch, regarding your question the literal is on heap and reference varibale to the literal is in String Pool .
Hope i answered you
[ May 09, 2006: Message edited by: faisal usmani ]
Joined: Mar 20, 2006
May 09, 2006 22:41:00
Objects are always created on the heap.
The reference to the literal Objects are stored in the String pool.
And the reference variable str also contains the same value as the reference value in the String pool.
I agree. Here's the link:
subject: Constant String Pool
== and equals()
String Object and GC
How many number of string objects are created?
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2013