A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
The Mikado Method
this week in the
Agile and other Processes
Programmer Certification (SCJP/OCPJP)
Joined: Jun 29, 2007
May 26, 2008 05:53:00
5.while reading scjp5 by kathy siera from page 420.
"Creating New Strings".There she explained two approaches for creating Strings.
2nd approach:String s="String".
Told there is subtle difference between those two.Once is created with new and the other is not.Also for the 1st approach she said like two String objects are created because of new?how come?.while latter only 1 object is created with 2nd approach
Joined: Feb 24, 2006
May 26, 2008 06:02:00
One String would be in the String pool and the other string would be the one created with the new operator when you type String s = new String("");.
With String s = "hi"; you create one object. This is the one in the String pool
SCJP 6 articles
SCJP 5/6 mock exams
SCJP 5 Mock exam (Word document )
SCJP 5 Mock exam in Java.Inquisition format
I agree. Here's the link:
- it saves me about five hours per week
subject: Creating Strings
what is the diff? (Strings again)
what's intern() in strings
How many objects????
How to get a transfer function to work both ways?
How we can find that how much string objects has been created?
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2013