A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
difference between two string object
Joined: May 29, 2008
Jul 04, 2010 23:15:07
String str = "Hello World"; String str1= new String ("hello World"); String str2 = "Hello World";
literals are identical, the compiler creates one String object for "Hello World" in the literal pool. It is then assigned to both str and str2. how refer str1 and str2 in string object?
what happened in memory ?
Please help me.
Joined: May 03, 2008
Jul 04, 2010 23:49:41
There is a
section for beginners' questions, you know.
There are no new questions, but there may be new answers.
Joined: Oct 27, 2005
Jul 05, 2010 00:58:57
Which is where I will move this thread.
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions
How To Answer Questions
It is sorta covered in the
JavaRanch Style Guide
subject: difference between two string object
String is created on pool?
How does String str = "str" work?
String and StringBuffer
Comparison with NaN
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2013