File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes String class and a shocking discovery! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "String class and a shocking discovery!" Watch "String class and a shocking discovery!" New topic

String class and a shocking discovery!

Basu Patel
Ranch Hand

Joined: May 28, 2000
Posts: 60
Describe the significance of the immutability of String objects?
Can anyone explain me this exam objective.
Also for SJCP exam for platform 2, the objectives do not have the java.awt Package-Components and Facilities
java.awt Package-Event Handlers
and java.awt Package -Painting.Is this true?...i mean some of these packages are too important to be not convered my the platform 2 objectives.
For reference check the following link to believe your eyes -

<BR>Contact Me<BR> <A HREF="" rel="nofollow"></A> <P>
Stephen Beausang

Joined: Jul 11, 2000
Posts: 6
A String Object is immutable in that once it is created in the
string pool the reference does not change. If the value in the String variable changes the a new String is created in the string pool and the reference now points to this. E.G
String s="Hello";
// reference to s points to "Hello" in the pool of available Strings
now reference to s points to a different string in the pool
because the original string is immutable and cannot be changed.
You need to be careful to pay attention to the wording in the exam as to whether the value stored in s changes or the original reference is changed. RHE are excellent on this. Ranch-hands feel free to correct this explanation as I am not sure if it is very clear.
As to the second question, I would definately spend some time studying components & painting, even though they are not specifically mentioned. As best as I can remember, I got a few questions that required some knowledge of both.
I agree. Here's the link:
subject: String class and a shocking discovery!
jQuery in Action, 3rd edition