• 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 ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

GArbage collection question

 
Ranch Hand
Posts: 486
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
class Archer {
public void finalize(){
System.out.println("finalizing");
}

}
public class Shula{
String[] sa= new String[10];
public static void main(String argv[]){
new Shula();
}
public Shula(){
String s = new String("Shula");
int i = 99;
i = null;
Archer a = new Archer();
a=null;
System.gc();
}
}


1. Compile time error
2 Compilation and output of "finalizing" at runtime
3 Compilation but no output at runtime
4 Compilation but runtime exception

The Correct Answer is
1) Compile time error.

Please explain this
saource :http://www.examulator.com
 
author
Posts: 23959
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, what happened when you compiled it? What error did the compiler report?

Hint: The error is somewhere near these lines...



Henry
 
You showed up just in time for the waffles! And this tiny ad:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic