This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes Garbage Collection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Garbage Collection " Watch "Garbage Collection " New topic

Garbage Collection

Vinod Sinha
Ranch Hand

Joined: Oct 16, 2003
Posts: 43
class Animal { //1
static int a=10;//2
public static void main(String args[]) { //3
callme(); //4
System.out.println("Hi"); //5
} //6
static void callme() //7
{ //8
} //10
} //11
After which line is 'a' eligible for garbage collection ?
1) Line 4
2) Line 5
3) None of the above
Tamizh Selvan

Joined: Oct 10, 2003
Posts: 15
Since 'a' is declared static, its scope is alive till the object persists. so the ans is obviously 3)none of the above

"No one knows what one can do until one tries"<br />-John Kingsley.
It is sorta covered in the JavaRanch Style Guide.
subject: Garbage Collection
Similar Threads
Wrapper class array and Garbage Collection
Question from go4java mock
Garbage Collection
Garbage collection
Grabage Collection