SCJP 6
Author of ExamLab - a free SCJP / OCPJP exam simulator
What would SCJP exam questions look like? -- OCPJP Online Training -- Twitter -- How to Ask a Question
All code in my posts, unless a source is explicitly mentioned, is my own.
SCJP 6 - SCWCD in progress...
SCJP 6
Morteza Manavi-Parast wrote:Thank you!
And just to clear any doubt, there is not any "annonymous inner class" invloved. The pitfall of this question, like already is said, is the right associativity of assignment operator. That's all!
All code in my posts, unless a source is explicitly mentioned, is my own.
Shin Kudo wrote:the trick here is after the line:
the annonymous inner class object becomes eligible for GC.
SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Ankit Garg wrote:
Shin Kudo wrote:the trick here is after the line:
the annonymous inner class object becomes eligible for GC.
Where is the anonymous inner class in this?? There is just a temporary intermediate object with no reference which becomes eligible for GC (I've marked it in bold). I hope this doesn't goes over everyone's heads
A d=new A().aob=new A();
I love Mozart (^o^)
yen hoang wrote:there are two objects legal for GC. Right?
yen hoang wrote:You can say that again! There is nothing called anonymous inner class.
SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Ankit Garg wrote:
yen hoang wrote:You can say that again! There is nothing called anonymous inner class.
Well actually I didn't see that people have already pointed it out that there is no anonymous inner class in this code, if that's what you mean. If you want to say that there is no anonymous inner class in this code, then it's fine. If you want to say that there are no anonymous inner classes in java, then I'm afraid you are wrong...
I love Mozart (^o^)
SCJP 6
I know Life is very Tough...But I AM TOUGHER
SCJP 1.5
NagarajGoud uppala wrote:
from the above discussion my understanding is, when we call the gc() it will remove the
objects which are not reffered by any reference variable and the objects
having the null value.
am i right???
SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
I know Life is very Tough...But I AM TOUGHER
SCJP 1.5
You get good luck from rubbing the belly of a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
|