my dog learned polymorphism*
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
Author

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.
FOR ALL THOSE WHO MAY NOT BE AWARE LIKE MYSELF-
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 - http://suned.sun.com/USA/certification/progobj.html


<BR>Contact Me<BR> <A HREF="mailto:basu_patel@usa.net" rel="nofollow">basu_patel@usa.net</A> <P>
Stephen Beausang
Greenhorn

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
s="Goodbye";
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: http://aspose.com/file-tools
 
subject: String class and a shocking discovery!