There actually are three Strings that are created: - "Hello" created on line 2 - "Pal" created on line 4 - combination of the two also created on line 4 So each String literal is created as a String object before it is used. And because Strings are immutable the combination of the two Strings is a whole new one.
Mika Leino<br />SCJP, SCWCD
If tomatoes are a fruit, then ketchup must be a jam. Taste this tiny ad:
Two software engineers solve most of the world's problems in one K&R sized book