Basic Java Interview Question and Answers

49. How can we force the garbage collector to run?
  Garbage collector can be run forcibly using "System.gc()" or "Runtime.gc()".
 
Your Name Your Email-ID
Your Answer
50. What restrictions are placed on method overriding?
 
  • Overridden methods must have the same name, argument list and return type.
  • The overriding method may not limit the access of the method it overrides.
  • The overriding method may not throw any exceptions that may not be thrown by the overridden method.
 
Your Name Your Email-ID
Your Answer
51. What is a package?
  A package stores a group of related classes and interfaces. They eliminate the conflicts in class names in different of classes.
 
Your Name Your Email-ID
Your Answer
52. What is memory footprint?
  When JVM needs more memory then it does the garbage collection, and sweeps all the memory which is not being used.
 
Your Name Your Email-ID
Your Answer