Narasimha
Try your free <a href="http://www.javacertificate.com" target="_blank" rel="nofollow">SCJP 1.4</a> certification centre.<br />Try your free <a href="http://www.j2eecertificate.com" target="_blank" rel="nofollow">SCWCD</a> certification centre.<br />Try your free <a href="http://www.ejbcertificate.com" target="_blank" rel="nofollow">SCBCD</a> certification centre.<br />Try your <a href="http://www.webspherecertificate.com" target="_blank" rel="nofollow">Websphere (Test 285) </a> certification centre.<br />Try your <a href="http://www.j2mecertificate.com" target="_blank" rel="nofollow">SCMAD</a> certification centre. (New)<br /> <br /><a href="http://blogs.javacertificate.com" target="_blank" rel="nofollow">Java/J2EE Certification Blogging</a>
- Do not try and bend the spoon. That's impossible. Instead, only try to realize the truth. - What truth? - That there is no spoon!!!
Software_guy
Spot false dilemmas now, ask me how!
(If you're not on the edge, you're taking up too much room.)
Software_guy
Originally posted by Sridhar Srinivasan:
Hi!
The string is created in the loop as follows:
loop from 1 to 9.So it creates
str="1" Object1
str="2" Object 2 (Object 1 collected)
str="3" Object 3 (Object 2 collected)
str="4" Object 4 (Object 3 collected)
str="5" Object 5 (Object 4 collected)
str="6" Object 6 (Object 5 collected)
str="7" Object 7 (Object 6 collected)
str="8" Object 8 (Object 7 collected)
str="9" Object 9 (Object 8 collected)
So the answer is 8.
Hi!
I have a question related to this.I read somewhere that the string literals are not Garbage collected.The above is a string literal rite?
The above is not as str=new String("value")-If this is the case, I accept that the value is 8.Can anybody explain pl!Thanks
42
Software_guy
- Do not try and bend the spoon. That's impossible. Instead, only try to realize the truth. - What truth? - That there is no spoon!!!
Narasimha
- Do not try and bend the spoon. That's impossible. Instead, only try to realize the truth. - What truth? - That there is no spoon!!!
Spot false dilemmas now, ask me how!
(If you're not on the edge, you're taking up too much room.)
- Do not try and bend the spoon. That's impossible. Instead, only try to realize the truth. - What truth? - That there is no spoon!!!
Spot false dilemmas now, ask me how!
(If you're not on the edge, you're taking up too much room.)
When I was younger I felt like a man trapped inside a woman’s body. Then I was born. My twin is a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
|