This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Rust Web Development and have Bastian Gruber on-line!
See this thread for details.
Win a copy of Rust Web Development this week in the Other Languages forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Garbage Collector?

Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
I have doubt on this question

In the following code, which is the earliest statement, where the object originally held in e, may be garbage collected:

1: public class Test {
2: public static void main (String args []) {
3: Employee e = new Employee("Bob", 48);
4: e.calculatePay();
5: System.out.println(e.printDetails());
6: e = null;
7: e = new Employee("Denise", 36);
8: e.calculatePay();
9: System.out.println(e.printDetails());
10: }
11: }

answer : Line 7

Why its line 7 not line 6?


    Bookmark Topic Watch Topic
  • New Topic