Err, just out of curiousity, how can you be sure this isn't on the exam? The method was atleast mentioned in my course-book whichs purpose is solely to prepare for the
SCJP and
SCJD.
I'm also curious about the following...
If you declare a String like this:
String s = new String("hi");
This will create a new String object in the program space (I believe). Now, if we assume the string "hi" is already in the string pool, and you issue the following:
String s = new String("hi).intern()
Will this in fact make 's' point to the string in the literal pool, and also avoid the creation of the extra String object in the program space?
// Andreas