Top 50+ Java Garbage Collections Interview Questions and Answers - 3
Question: 11
What is phantom memory?
Phantom memory is false memory. Memory that does not exist in reality.
Question: 12
What is final, finalize() and finally?
final: final keyword can be used for class, method and variables.
A final class cannot be sub classed and it prevents other programmers from sub classing a secure class to invoke insecure methods.
A final method can’t be overridden.
A final variable can’t change from its initialized value.
finalize() – finalize() method is used just before an object is destroyed and can be called prior to garbage collection.
finally() - a key word used in exception handling, creates a block of code that will be executed after a try/catch block. The finally block will execute whether or not an exception is thrown.
Question: 13
Is it advisable to depend on finalize for all cleanups?
The purpose of finalization is to give an opportunity to an unreachable object to perform any clean up before the object is garbage collected, and it is advisable.
Question: 14
Can an object’s finalize() method be invoked while it is reachable?
An object’s finalize() method cannot be invoked by the garbage collector while the object is still reachable.
However, an object’s finalize() method may be invoked by other objects.
DC Generator Questions and Answers Pdf More
Electromagnetic Induction Quiz Questions and Answers More
Basic Electronics Quiz Questions with Answers Pdf More
Wireless Communication MCQ Questions with Answers More
Digital Communication Quiz Questions and Answers Pdf More
50+ Arithmetic Reasoning Questions and Answers Pdf More
1000+ MS Word MCQs with Answers Pdf Download More
Top 50+ Partnership Aptitude Questions and Answers More
Important One Word Substitution Pdf for Competitive Examination More
1000+ World History General Knowledge Questions and Answers More