posted 15 years ago
String s = "fred" will be created when the class will be loaded and the reference will be added to the string pool so that if in future any satement uses "fred",it will just refer to the existing object in stead of making a new one ( although thats not needed here)
so, 3 objects at runtime will be created.
But, i have one question, what if they do not specify runtime or compilation time???Should i write 4 or i assume they are refering to the runtime scenario??
SCJP 5
"I fear not the man who has practiced 10,000 kicks once, but I fear the man who has practiced one kick 10,000 times" - Bruce Lee