This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Quession of gc

 
Hades Pan
Ranch Hand
Posts: 106
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1.public static void main(String args[]) {
2. Object o=new Float(12.4f);
3. Object []oa=new Object[1];
4. oa[0]=o;
5. o=null;
6. oa[0]=null;
7. return 0;
8.}
Where will be the garbage collecter may invoke?
a) just after line no.5
b) just after line no.6
c) just after line no.7
d) never invokes
e) compilation error
 
Jennifer Warren
Ranch Hand
Posts: 53
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Answer is e). Compilation error.
As the main methods return type is void and here in the code on line 7 return 0; will give u an error.
Further, one can never be sure that when Garbage collector will be invoked as it is a low priority thread.

Jennifer.
 
amit mawkin
Ranch Hand
Posts: 73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jennifer thatw as the coolest of all
lol
------------------
coffee drinker
 
Hades Pan
Ranch Hand
Posts: 106
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank Jennifer~~!
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic