Garbage Collection Interview Questions and Answers in Java | With Live Demo | Code Decode

  Рет қаралды 91,120

Code Decode

Code Decode

3 жыл бұрын

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:
openinapp.co/udemycourse
Course Description Video :
yt.openinapp.co/dmjvd
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?
Finalize method in Java also called finalizer is a method defined in java.lang.Object
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
• Garbage Collection Int...
-------------------------------------------------------------------------------------------------------------------------------------
Code Decode Playlists
Most Asked Core Java Interview Questions and Answers : • Core Java frequently a...
Advance Java Interview Questions and Answers : • Advance Java Interview...
Java 8 Interview Questions and Answers : • Java 8 Interview Quest...
Hibernate Interview Questions and Answers : • Hibernate Interview Qu...
Spring Boot Interview Questions and Answers : • Advance Java Interview...
Angular Playlist : • Angular Course Introdu...
GIT : • GIT
-------------------------------------------------------------------------------------------------------------------------------------
Subscriber and Follow Code Decode
Subscriber Code Decode : kzbin.info?...
Linkedin : / codedecodeyoutube
Instagram : / codedecode25
--------------------------------------------------------------------------------------------------------------------------------------
#garbageCollectionInterviewQuestions #codedecode #garbageCollectionJava

Пікірлер: 84
@srinivasacharya4695
@srinivasacharya4695 3 жыл бұрын
perfect explanation!! I really feel happy about your channel's content and Iam pretty sure that when someone follows all your content, he/she can really crack any technical round on java. Deep explanation which gets into us shows your skill.
@CodeDecode
@CodeDecode 3 жыл бұрын
Thanks srinivas for writing back to us. We are glad that we are able to help. Thanks for the motivation, keep learning keep growing
@rangarajugottumukkala9380
@rangarajugottumukkala9380 2 жыл бұрын
Mam, you are awesome and helping all learners and there is no lag. Point to point explanations..Gr8 and thankful to you
@CodeDecode
@CodeDecode 2 жыл бұрын
Thanks a lot 🙂🙂👍👍
@vinodkumar-ev6uv
@vinodkumar-ev6uv 3 жыл бұрын
Thanks for the nice explanation, would be helpful if you can also share the presentation.
@ravirajsaraganachari3038
@ravirajsaraganachari3038 3 жыл бұрын
Your explanation is next level. Please continue with same courage, keep upload the videos mam. Tq :)
@CodeDecode
@CodeDecode 3 жыл бұрын
Thanks for the nice words 👍
@mehulchauhan6947
@mehulchauhan6947 3 жыл бұрын
Thanks for making it so easy to understand.
@CodeDecode
@CodeDecode 3 жыл бұрын
👍👍🙂🙂
@sanjeevkumarsah4047
@sanjeevkumarsah4047 2 жыл бұрын
Awesome. Thanks for sharing knowledge 🙏
@CodeDecode
@CodeDecode 2 жыл бұрын
you're welcome Sanjeev
@mrrishiraj88
@mrrishiraj88 7 ай бұрын
Great thanks! I will refer the video again.
@CodeDecode
@CodeDecode 7 ай бұрын
Thanks
@sanjushekhawat6446
@sanjushekhawat6446 3 жыл бұрын
Thanks a lot my all concept clear plz keep it
@CodeDecode
@CodeDecode 3 жыл бұрын
we are glad we were able to clear your concepts. Please let us know if you have any queries
@shubhamasthana191
@shubhamasthana191 3 жыл бұрын
great explanation thank u so much🙏
@CodeDecode
@CodeDecode 3 жыл бұрын
Your welcome 👍
@manojpandey6661
@manojpandey6661 3 жыл бұрын
Thanks for this video. It would be helpful if you please cover heap part i.e young gen ,old gen and parm gen in detail in part 2 of this video.
@CodeDecode
@CodeDecode 3 жыл бұрын
Ok. Will upload part 2 soon then
@rajsaraogi
@rajsaraogi Жыл бұрын
If suppose i initalize a object inside a local function and the function call completes will my object created locally be garbage collected automatically?
@haresh4063
@haresh4063 Жыл бұрын
It's masterpiece video to learn garbage collection in java
@CodeDecode
@CodeDecode Жыл бұрын
Thanks for the nice words
@ruwan2471
@ruwan2471 3 жыл бұрын
Thank you so much !!!
@CodeDecode
@CodeDecode 3 жыл бұрын
👍
@adityadalvi7884
@adityadalvi7884 3 жыл бұрын
Thank you ma'am , nice explanation : )
@CodeDecode
@CodeDecode 3 жыл бұрын
Thanks Aditya 👍👍
@tusharpatil2749
@tusharpatil2749 3 жыл бұрын
What is the use case of creating isolation? If we want our objects as garbage collected, then we can directly make two object as null. Why there is need of isolation.
@kidschannel3090
@kidschannel3090 2 жыл бұрын
Explaination is nothing but Awesome 💞
@CodeDecode
@CodeDecode 2 жыл бұрын
Thanks
@abhishekkulkarni3466
@abhishekkulkarni3466 2 жыл бұрын
Thanks mam for excellent video. By any chance we can avail all the ppts of your videos?
@aakashgupta7211
@aakashgupta7211 2 жыл бұрын
Your videos are so helpful mam. Keep up the good work 👍
@CodeDecode
@CodeDecode 2 жыл бұрын
Thanks Aakash 🙂👍
@vinothkumarg7731
@vinothkumarg7731 3 жыл бұрын
Thanks mam for this video.very useful. Pls do video for multithreading and concurrent exception concepts..
@CodeDecode
@CodeDecode 3 жыл бұрын
Sure will create a video on threads too
@romiltiwari2643
@romiltiwari2643 3 жыл бұрын
Outstanding , Please upload the video for Multi-Threading asap. If possible for Java8 also it will be a great help.
@CodeDecode
@CodeDecode 3 жыл бұрын
Sure m planning to upload them soon
@mohitbang5556
@mohitbang5556 3 жыл бұрын
Doing good job... Keep it up...!!
@CodeDecode
@CodeDecode 3 жыл бұрын
Thanks for the nice words 👍
@rohanseth6632
@rohanseth6632 3 жыл бұрын
Good day Mam. Thanks for your videos, you are clearing many misunderstandings of the java framework. Mam, can you please share some knowledge on garbage collection algorithms and their evolution ? I recently got this question in an interview and was not able to answer. I saw there are videos and blogs out there, but nobody has tell from scratch. Can you please help in this sometime in near future ?
@CodeDecode
@CodeDecode 3 жыл бұрын
Sure. That's a very nice topic. Will surely put a video on that. Thanks 👍👍
@manognajoshik8465
@manognajoshik8465 2 жыл бұрын
Ma'am awesome content.. waiting for multithreading and synchronisation, rmi topics
@CodeDecode
@CodeDecode 2 жыл бұрын
Sure Manogna we will upload soon 👍🙂
@rohitahirwar125
@rohitahirwar125 Жыл бұрын
GC k through object bhi delete hojata h kya ? ya phir bas usne jo memory bannyi h vo bas?
@varunsharma0099
@varunsharma0099 2 жыл бұрын
🙏🙏🙏🙏 really really really thankful to you .🙏🙏🙏🙏
@CodeDecode
@CodeDecode 2 жыл бұрын
🙂👍 Thanks Varun
@nageshnikavade7712
@nageshnikavade7712 7 ай бұрын
@CodeDecode team Thanks for such a nice explanation, and if possible where we can get the PPT that you used
@BobanPRaj
@BobanPRaj 3 жыл бұрын
Good video thanks. But one doubt: the finalize is called after the main method is done, which means the gc we called didn't reclaimed the memory of that object right? The reclaim is dne automatically once the scope of that object is gone right?
@CodeDecode
@CodeDecode 3 жыл бұрын
If set explicitly to null then memory will not have any reference left then it will be any how garbage collected. Else Yes whenever scope of variables ends it's eligible for garbage collection
@saiprakash1125
@saiprakash1125 3 жыл бұрын
Great video 👌
@CodeDecode
@CodeDecode 3 жыл бұрын
Thanks
@pareshpatil8679
@pareshpatil8679 Жыл бұрын
in Island of isolation --> why did you not directly pointe the refernce to null , why did you use instance reference variable and then alterd the poniting .. and then set to null ...?? what was logic behind this much Traverse ??????
@DineshSharma-xi1lq
@DineshSharma-xi1lq 11 ай бұрын
But what is the use of island of isolation?
@urnotSylvia
@urnotSylvia Жыл бұрын
Hi mam, thanks for the video. But what's the difference in result between doing the steps of creating island of isolation and point the references directly to null? Thanks.
@gayatrideshpande5456
@gayatrideshpande5456 6 ай бұрын
I am having same doubt. Didn't get clear idea of island of isolation
@srinivasyadav9925
@srinivasyadav9925 Жыл бұрын
If finalize method is called before system.gc is called then why main method is called printed it should print finalize method is called right?
@alekyajaini3749
@alekyajaini3749 17 күн бұрын
That was really a great explanation. Every video in this Java playlist is informative and helpful.Also could you please make a seperate video on island of isolation . Also pls let us know if you would provide any paid trainings. I have tried to contact you in instagram..bt didn't get any response. If any mail id to check about paid training.. definitely would be helpful Thanks
@vasanthabhanu8191
@vasanthabhanu8191 2 жыл бұрын
How many years of experience you have?
@techkid358
@techkid358 7 күн бұрын
how to explain islands of isolation in interview ?
@karishmarawat1359
@karishmarawat1359 3 жыл бұрын
Great Explanation! 👌👌 Also after going through comments now I am also curious to know your name.🙂🙏
@CodeDecode
@CodeDecode 3 жыл бұрын
Thanks Karishma. We will reveal that soon 🙃🙏
@sreejak6776
@sreejak6776 2 жыл бұрын
Hi mam, there is a little confusion in the last point that you have mentioned.Should all the foreground threads stop for the background thread to stop running or is it vice-versa? The statement which you told seems little contradactory.Could you pls explain it. Thanks!!
@CodeDecode
@CodeDecode 2 жыл бұрын
When all foreground threads stops, all background threads created will be terminated. Example is explained in these videos kzbin.info/aero/PLyHJZXNdCXsdUXzeeBZIADof_U-40jBJO
@priyankakhamkar1112
@priyankakhamkar1112 3 жыл бұрын
please make a video on Island of isolation . Please make video on multithreading as well.
@CodeDecode
@CodeDecode 3 жыл бұрын
Will do that soon 👍
@shikhasrivastav9208
@shikhasrivastav9208 3 жыл бұрын
Island of isolation is not clear. Please upload a separate video.
@CodeDecode
@CodeDecode 3 жыл бұрын
Sure will create seperate video on this too
@nikikinlekar6968
@nikikinlekar6968 3 жыл бұрын
Please make video on tricky multi Threading interview questions
@CodeDecode
@CodeDecode 3 жыл бұрын
Sure will create on that soon
@nandinibagga4857
@nandinibagga4857 2 жыл бұрын
awesome awesome awesome
@CodeDecode
@CodeDecode 2 жыл бұрын
Thanks Nandini....
@vasuc4190
@vasuc4190 3 жыл бұрын
Explain healthcare project for inteview purpose
@sahuamit30
@sahuamit30 3 жыл бұрын
You are awesome 👏
@CodeDecode
@CodeDecode 3 жыл бұрын
Thanks Amit 👍👍
@sahuamit30
@sahuamit30 3 жыл бұрын
@@CodeDecode may I know ur name please Mam Do u give any paid training sessions
@start1learn-n171
@start1learn-n171 5 ай бұрын
Tq
@CodeDecode
@CodeDecode 5 ай бұрын
Welcome
@dhanunjaya_07
@dhanunjaya_07 10 ай бұрын
Please create a new video for islands of isolation
@CodeDecode
@CodeDecode 10 ай бұрын
Sure we will create it soon
@rajeshprince758
@rajeshprince758 3 жыл бұрын
Pls upload maltitherad .. interview questions
@CodeDecode
@CodeDecode 3 жыл бұрын
Sure will create video on multi threading too soon
@rajeshprince758
@rajeshprince758 3 жыл бұрын
@@CodeDecode pls upload spring questions too
@dhirajsumatkar725
@dhirajsumatkar725 10 ай бұрын
Mam please share this PPT.
@giantbush4258
@giantbush4258 6 ай бұрын
No offense but please stop says nothing but.
@CodeDecode
@CodeDecode 6 ай бұрын
Sure 😊😊
НЫСАНА КОНЦЕРТ 2024
2:26:34
Нысана театры
Рет қаралды 791 М.
How Many Balloons Does It Take To Fly?
00:18
MrBeast
Рет қаралды 184 МЛН
Red❤️+Green💚=
00:38
ISSEI / いっせい
Рет қаралды 82 МЛН
9. Java Memory Management and Garbage Collection in Depth
48:48
Concept && Coding - by Shrayansh
Рет қаралды 58 М.
01. Internal Working of HashMap & Java-8 Enhancement
19:11
WebEncyclop Tutorials
Рет қаралды 106 М.
Top 25 Microservice Interview Questions Answered - Java Brains
39:54
Middle Class FOOLED Once Again? | Budget 2024 | Dhruv Rathee
20:09
Dhruv Rathee
Рет қаралды 3 МЛН
НЫСАНА КОНЦЕРТ 2024
2:26:34
Нысана театры
Рет қаралды 791 М.