I know this seems to be a very basic questions but still want to clear my basic knowledge so i am asking this question What is String Pool in java?
what is difference between
String var="DANIWEB;
and
String var =new String("DANIWEB");
jamesr12
0
Newbie Poster
Recommended Answers
Jump to PostString var = "daniweb"; String val = "daniweb";
the above will only place one String in the pool, and the other String will point to that one as well.
String var = "daniweb"; String val = new String("daniweb");
since you here are explicitly saying …
Jump to Posthttp://en.wikipedia.org/wiki/String_interning
I've never heard of a reason why you would force allocation of a new String object with
new String("daniweb"
as opposed to allowing the compiler to intern it, and right now …
All 8 Replies
stultuske
1,116
Posting Maven
Featured Poster
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
stultuske
1,116
Posting Maven
Featured Poster
jamesr12
0
Newbie Poster
stultuske
1,116
Posting Maven
Featured Poster
jamesr12
0
Newbie Poster
~s.o.s~
2,560
Failure as a human
Team Colleague
Featured Poster
jamesr12
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.