Check out my kickstarter CLICK HERE
My book, my movies, my videos, my podcasts, my events ... the big collection of paul wheaton stuff!
Originally posted by Siddhu:
Here is a method which creates a number of String objects in the course of printing a
series of messages.
1)public void SoundOff() {
2) for(int i = 0; i < 10; i++) {
3) String tmp = Integer.toString(i);
4) System.out.print(tmp + ",");
5) }
6) System.out.println("10");
7)}
When the program reaches line 6,how many of the String objects created in line 3 are eligible for garbage collection?Assume that
System.out object is not keeping a reference.
a) none
b) 1
c) 8
d) 9
Check out my kickstarter CLICK HERE
My book, my movies, my videos, my podcasts, my events ... the big collection of paul wheaton stuff!
Originally posted by Paul Wheaton:
I am not shure but this can have to do with the references on the current thread stack. The instances are created on the heap
but the methdoe references on the tread stack so it means that no object is ready untill the methode returns.
"JavaRanch, where the deer and the Certified play" - David O'Meara
Originally posted by Paul Wheaton:
[B]The root of the answer lies in "how many of the String objects created in line 3 are eligible for garbage collection?"
Note the "line 3" part.
Note all
if any person have good mock on thread pls send me
or also if any person have good examples nearthe real exam on thread pls send me
------------------
sunglasses are a type of coolness prosthetic. Check out the sunglasses on this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
|