Hmm, actually I think ShivaPrasad is right - the Strings aren't in the program's space, so I don't think they're garbage collected at all. Might be a useful thing to remember for the exam - thanks! I'd have been right if all the Strings were created with a new String() statement though, wouldn't I?
Isn't name eligible to be garbage collected because of the assignment name = null;? Betty, be careful not to mix up references and the objects they refer to! In the code example, the variable name first contains a reference to the String "Frieda". Then the value of name is assigned to newestName, which means that the newestName reference now refers to "Frieda" too. Finally name is set to null, so it doesn't refer to anything - but "Frieda" still has a live reference, newestName.