filmov
tv
Garbage Collection Interview Questions and Answers in Java | With Live Demo | Code Decode
Показать описание
In this video of code decode we have covered Garbage Collection Interview questions for experienced and fresher in Java
Udemy Course of Code Decode on Microservice k8s AWS CICD link:
Course Description Video :
Garbage collection in java is a very crucial and complicated interview topic. It hides many complexities within.
As an overview we can say that Garbage collection in java is an automatic process of looking at heap memory, identifying which objects are in use and which are not, and deleting the unused objects.
An in use object, or a referenced object, means that some part of your program still maintains a pointer to that object.
An unused object, or unreferenced object, is no longer referenced by any part of your program. So the memory used by an unreferenced object can be reclaimed.
Main Advantage of automatic garbage collection in java is that it removes the burden of manual memory allocation/deallocation from us so that we can focus on problem solving.
Area where we get this object manages is heap :
Whenever an object is created, it’s always stored in the Heap space and stack memory contains the reference to it. Stack memory only contains local primitive variables and reference variables to objects in heap space.
Thus All Java objects are always created on heap in java. EG
CustomeObj s1 = new CustomeObj ()
What are the different ways to make an object eligible for GC when it is no longer needed??
1) Set all available object references to null
2) Make the reference variable to refer to another object
3) Creating Islands of Isolation
In video we have seen live demo of all the three methods
What is the purpose of overriding finalize() method?
Its called by Garbage collector just before collecting any object which is eligible for GC.
Thus Finalize() method provides last chance to object to do cleanup and free any remaining resource
In video we have seen live demo of overriding Object class's finalize method so that we can implement our customization before garbage collection is called.
And many such java garbage collection interview questions are solved using live demo examples.
Heap memory and generation strategy is covered in next section
Garbage Collections Interview Questions part -2
-------------------------------------------------------------------------------------------------------------------------------------
Code Decode Playlists
-------------------------------------------------------------------------------------------------------------------------------------
Subscriber and Follow Code Decode
--------------------------------------------------------------------------------------------------------------------------------------
#garbageCollectionInterviewQuestions #codedecode #garbageCollectionJava
Udemy Course of Code Decode on Microservice k8s AWS CICD link:
Course Description Video :
Garbage collection in java is a very crucial and complicated interview topic. It hides many complexities within.
As an overview we can say that Garbage collection in java is an automatic process of looking at heap memory, identifying which objects are in use and which are not, and deleting the unused objects.
An in use object, or a referenced object, means that some part of your program still maintains a pointer to that object.
An unused object, or unreferenced object, is no longer referenced by any part of your program. So the memory used by an unreferenced object can be reclaimed.
Main Advantage of automatic garbage collection in java is that it removes the burden of manual memory allocation/deallocation from us so that we can focus on problem solving.
Area where we get this object manages is heap :
Whenever an object is created, it’s always stored in the Heap space and stack memory contains the reference to it. Stack memory only contains local primitive variables and reference variables to objects in heap space.
Thus All Java objects are always created on heap in java. EG
CustomeObj s1 = new CustomeObj ()
What are the different ways to make an object eligible for GC when it is no longer needed??
1) Set all available object references to null
2) Make the reference variable to refer to another object
3) Creating Islands of Isolation
In video we have seen live demo of all the three methods
What is the purpose of overriding finalize() method?
Its called by Garbage collector just before collecting any object which is eligible for GC.
Thus Finalize() method provides last chance to object to do cleanup and free any remaining resource
In video we have seen live demo of overriding Object class's finalize method so that we can implement our customization before garbage collection is called.
And many such java garbage collection interview questions are solved using live demo examples.
Heap memory and generation strategy is covered in next section
Garbage Collections Interview Questions part -2
-------------------------------------------------------------------------------------------------------------------------------------
Code Decode Playlists
-------------------------------------------------------------------------------------------------------------------------------------
Subscriber and Follow Code Decode
--------------------------------------------------------------------------------------------------------------------------------------
#garbageCollectionInterviewQuestions #codedecode #garbageCollectionJava
Комментарии