The same constant is loaded. Does that suggest that the same String object is being referenced?
Hi Marlene, Yes, I think its the same 'Object'. From the book "Inside the Java Virtual Machine by Bill Venners"
Three opcodes (ldc,ldc_w, ldc2_w) push constants from the constant pool. These opcodes take operands that specify a constant pool index. The Java virtual machine looks up the constant pool entry given the index, determines the constant's type and value, and pushes it onto the stack.
Thanks for all the replies. And thanks for the clarification, Corey. I just assumed garabage collection meant that. I downloaded a 1.4 mock exam program, but after taking it and being asked such a question I had no way to verify it because the darn thing didn't show me what I got wrong! It really was like the real thing :-)
WARNINGthe following is not exam stuffWARNING Hey Marlene I am sure you would appreciate to know that string literals can be g.c.ed as this post shows.
SCJP2. Please Indent your code using UBB Code
Joined: Mar 05, 2003
Thank you very much Jose - in advance of reading your reference. I scanned the forum (104 search results), but I missed that one. Yes, I am interested. [ June 26, 2003: Message edited by: Marlene Miller ]
Joined: May 16, 2003
I think it's great to have the experienced ranchers point out when a topic is not covered on the exam. Since there "seems" to be an infinite number of details you can learn if you want, there comes a point where you really only want spend your time learning topics which Sun considers most relevant (thus are on the exam). Thanks! [ June 26, 2003: Message edited by: Brian Joseph ]