"JavaRanch, where the deer and the Certified play" - David O'Meara
Originally posted by Cindy Glass:
The variable first holds a reference to an object. Then it is used to create riddle. The riddle variable also gets a reference to the same object in line c. Setting first to null does not get rid of the reference in riddle, which is held until the end of the method.
String buffers are used by the compiler to implement the binary string concatenation operator . For example, the code:
x = "a" 4 "c"
is compiled to the equivalent of:
x = new StringBuffer().append("a").append(4).append("c").toString()
which creates a new string buffer (initially empty), appends the string representation of each operand to the string buffer in turn, and then converts the contents of the string buffer to a string. Overall, this avoids creating many temporary strings.
Open Group Certified Distinguished IT Architect. Open Group Certified Master IT Architect. Sun Certified Architect (SCEA).
Open Group Certified Distinguished IT Architect. Open Group Certified Master IT Architect. Sun Certified Architect (SCEA).
<UL TYPE=SQUARE><I><LI>Ryan Burgdorfer<BR><LI>Java Acolyte</I></UL>
"JavaRanch, where the deer and the Certified play" - David O'Meara
Open Group Certified Distinguished IT Architect. Open Group Certified Master IT Architect. Sun Certified Architect (SCEA).
Do you pee on your compost? Does this tiny ad?
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
|