This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Five Lines of Code and have Christian Clausen on-line!
See this thread for details.
Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!

Pujan Shah

+ Follow
since Jun 28, 2007
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Pujan Shah

Hi I have started preparing for SCDJWS certification. Could you please help me by providing your notes?

How do i search this forum posts which have more than 10 replies in past 3 months? I remember reading very informative post on "string" with 17 or something replies but could not locate it now by normal search. It takes lot of time to navigate.
Thanks Henry & Ahmed. I got it now.
Following example is from K&B book chapter 3. It is part of self test example. Can someone explain why there are 2 objects (c1=null and Short story=5 ) eligible for GC?

As i do see there should be 4 variables eligible for gc because at line c3= c1.go(c2); means c3 =null after execution and same time c2/cb also becomes null in same process.

so eventually c1,short,c2 and c3 should be eligible for gc. no?


class CardBoard {
Short story = 5;
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
} }
When // doStuff is reached, how many objects are eligible for GC?