Hi
Prasad, as u know System.out variable is a PrintStream object.
In the PrintStream's println(int) the following methods is called,
String.valueOf(int);
valueOf(int) method in the
String class calls the Integer.toString(int), which creates a new String object.
So, passing the primitives to the System.out.println() method creates a String object.
Passing an Object to the System.out.println() method calls the objects
toString() method if the object reference is not null, if the object reference is null, a new String "null" is created and written to the stream.
---------------------
Hi
Matt, in the following code it looks like all the 11 objects will be
garbaged collected !.
When the output stream objects get a String object,
it will take the characters out from the String and outputs to the underlying sink ( it may use char[], or byte[] for buffering and flushes the buffer).
So y the PrintStream should hold the reference to the last Object in the for loop. rite ??
So i guess ur rite, 11 objects will be garbage collected
Correct me if am wrong
[This message has been edited by Jon Aryan (edited November 14, 2000).]