Exaple from K&B's book:
how many
String objects and how many reference variables were
created prior to the println statement? explain please?
String s1 = "spring ";
String s2 = s1 + "summer ";
s1.concat("fall ");
s2.concat(s1);
s1 += "winter ";
System.out.println(s1 + " " + s2);
K&B's book say?
There were a total of eight String
objects created as follows: �spring�, �summer � (lost), �spring summer�, �fall�(lost), �spring fall� (lost), �spring summer spring� (lost), �winter� (lost), �spring
winter� (at this point �spring� is lost). Only two of the eight String objects are not lost in this process.
[ June 15, 2007: Message edited by: Aaron Raja ]