|BSc in Electronic Eng| |SCJP 6.0 91%| |SCWCD 5 92%|
SCJP 6 [86%], OCPWCD [84%], OCEJPAD [83%]
If you find any post useful, click the "plus one" sign on the right
OCPJP 6.0 93%
OCPJWCD 5.0 98%
mohitkumar gupta wrote:why is c1 and it's short variable eligible for garbage collection ?
an object is eligible for GC, if there is no more references to it.
|BSc in Electronic Eng| |SCJP 6.0 91%| |SCWCD 5 92%|
Abimaran Kugathasan wrote:
mohitkumar gupta wrote:why is c1 and it's short variable eligible for garbage collection ?
an object is eligible for GC, if there is no more references to it.
Let's put that coding in a Code Tag.
After Line 01, can you access the Object which we've created in the Line Ob 01?
SCJP6.0,My blog Ranchers from Delhi
phil sohan wrote:
when line 01 is removed how many object are eligible for garbage collection.........................
|BSc in Electronic Eng| |SCJP 6.0 91%| |SCWCD 5 92%|
class CardBoard{
Short story = 200 ;
CardBoard go(CardBoard cb) {
cb = null ;
return cb ;
}
public static void main(String [] args){
CardBoard c1 = new CardBoard();
CardBoard c2 = new CardBoard();
CardBoard c3 = c1.go(c2) ;
c1 = null ;
// do stuff
}
}
Thanks & Regards
Sumit Kothalikar
G