SlideShare a Scribd company logo
1 of 7
Download to read offline
EP. 4
Java interview
By Ashay Nayak
Hi Priya! I am Ashay.
I am going to take
your technical round.
Hey Ashay! Thanks
for giving me this
oppportunity.
By Ashay Nayak
I am going to ask
few Java Questions.
okay.
By Ashay Nayak
What is garbage
collection in Java?
If any object is no longer in use
then we should remove that
object from heap memory. The
process of removing unused
objects from heap memory is
known as Garbage collection.
By Ashay Nayak
hmm...
Why do we use
finalize () method in
Java?
Sometimes object contains non-
java resources like connection
details and we want that object to
release those resources before
getting deleted. Thus, garbage
collector calls finalize() method just
before deleting the object where all
resources get released.
By Ashay Nayak
By Ashay Nayak
finalize() method present in Object class doesn’t
contain any implementation. So there is a need to
override the finalize() method to define the actions
which we want to do before object deletion.
Let’s say we have created a Test class. We will
override finalize() method inside it. Now when any
object of the Test class becomes eligible for
garbage collection, this override method will be
called. If you don’t override then the default
implementation of finalize() method present in the
Object class will be called and nothing will happen
as it doesn’t contain any implementation.
Knowledge for You
To Be Continued...
By Ashay Nayak

More Related Content

More from NiravPanchal50

SQL EXCLUSIVE NOTES .pdf
SQL EXCLUSIVE NOTES .pdfSQL EXCLUSIVE NOTES .pdf
SQL EXCLUSIVE NOTES .pdfNiravPanchal50
 
SQL and DBMS INTERVIEW QUESTIONS .pdf
SQL and DBMS INTERVIEW QUESTIONS .pdfSQL and DBMS INTERVIEW QUESTIONS .pdf
SQL and DBMS INTERVIEW QUESTIONS .pdfNiravPanchal50
 
𝙅𝙖𝙫𝙖 𝙄𝙣𝙩𝙚𝙧𝙫𝙞𝙚𝙬 𝙌𝙪𝙚𝙨𝙩𝙞𝙤𝙣𝙨 𝙉𝙤𝙩𝙚𝙨.pdf
𝙅𝙖𝙫𝙖 𝙄𝙣𝙩𝙚𝙧𝙫𝙞𝙚𝙬 𝙌𝙪𝙚𝙨𝙩𝙞𝙤𝙣𝙨 𝙉𝙤𝙩𝙚𝙨.pdf𝙅𝙖𝙫𝙖 𝙄𝙣𝙩𝙚𝙧𝙫𝙞𝙚𝙬 𝙌𝙪𝙚𝙨𝙩𝙞𝙤𝙣𝙨 𝙉𝙤𝙩𝙚𝙨.pdf
𝙅𝙖𝙫𝙖 𝙄𝙣𝙩𝙚𝙧𝙫𝙞𝙚𝙬 𝙌𝙪𝙚𝙨𝙩𝙞𝙤𝙣𝙨 𝙉𝙤𝙩𝙚𝙨.pdfNiravPanchal50
 
Javascript String Methods.pdf
Javascript String Methods.pdfJavascript String Methods.pdf
Javascript String Methods.pdfNiravPanchal50
 
Java Algorithm Interview Questions & Answers .pdf
Java Algorithm Interview Questions & Answers .pdfJava Algorithm Interview Questions & Answers .pdf
Java Algorithm Interview Questions & Answers .pdfNiravPanchal50
 

More from NiravPanchal50 (8)

SQL cheat sheet.pdf
SQL cheat sheet.pdfSQL cheat sheet.pdf
SQL cheat sheet.pdf
 
SQL Short Notes.pdf
SQL Short Notes.pdfSQL Short Notes.pdf
SQL Short Notes.pdf
 
SQL EXCLUSIVE NOTES .pdf
SQL EXCLUSIVE NOTES .pdfSQL EXCLUSIVE NOTES .pdf
SQL EXCLUSIVE NOTES .pdf
 
SQL and DBMS INTERVIEW QUESTIONS .pdf
SQL and DBMS INTERVIEW QUESTIONS .pdfSQL and DBMS INTERVIEW QUESTIONS .pdf
SQL and DBMS INTERVIEW QUESTIONS .pdf
 
SQL Joins.pdf
SQL Joins.pdfSQL Joins.pdf
SQL Joins.pdf
 
𝙅𝙖𝙫𝙖 𝙄𝙣𝙩𝙚𝙧𝙫𝙞𝙚𝙬 𝙌𝙪𝙚𝙨𝙩𝙞𝙤𝙣𝙨 𝙉𝙤𝙩𝙚𝙨.pdf
𝙅𝙖𝙫𝙖 𝙄𝙣𝙩𝙚𝙧𝙫𝙞𝙚𝙬 𝙌𝙪𝙚𝙨𝙩𝙞𝙤𝙣𝙨 𝙉𝙤𝙩𝙚𝙨.pdf𝙅𝙖𝙫𝙖 𝙄𝙣𝙩𝙚𝙧𝙫𝙞𝙚𝙬 𝙌𝙪𝙚𝙨𝙩𝙞𝙤𝙣𝙨 𝙉𝙤𝙩𝙚𝙨.pdf
𝙅𝙖𝙫𝙖 𝙄𝙣𝙩𝙚𝙧𝙫𝙞𝙚𝙬 𝙌𝙪𝙚𝙨𝙩𝙞𝙤𝙣𝙨 𝙉𝙤𝙩𝙚𝙨.pdf
 
Javascript String Methods.pdf
Javascript String Methods.pdfJavascript String Methods.pdf
Javascript String Methods.pdf
 
Java Algorithm Interview Questions & Answers .pdf
Java Algorithm Interview Questions & Answers .pdfJava Algorithm Interview Questions & Answers .pdf
Java Algorithm Interview Questions & Answers .pdf
 

Recently uploaded

KCD Costa Rica 2024 - Nephio para parvulitos
KCD Costa Rica 2024 - Nephio para parvulitosKCD Costa Rica 2024 - Nephio para parvulitos
KCD Costa Rica 2024 - Nephio para parvulitosVictor Morales
 
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor CatchersTechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catcherssdickerson1
 
Research Methodology for Engineering pdf
Research Methodology for Engineering pdfResearch Methodology for Engineering pdf
Research Methodology for Engineering pdfCaalaaAbdulkerim
 
Immutable Image-Based Operating Systems - EW2024.pdf
Immutable Image-Based Operating Systems - EW2024.pdfImmutable Image-Based Operating Systems - EW2024.pdf
Immutable Image-Based Operating Systems - EW2024.pdfDrew Moseley
 
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENT
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENTFUNCTIONAL AND NON FUNCTIONAL REQUIREMENT
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENTSneha Padhiar
 
Robotics Group 10 (Control Schemes) cse.pdf
Robotics Group 10  (Control Schemes) cse.pdfRobotics Group 10  (Control Schemes) cse.pdf
Robotics Group 10 (Control Schemes) cse.pdfsahilsajad201
 
Mine Environment II Lab_MI10448MI__________.pptx
Mine Environment II Lab_MI10448MI__________.pptxMine Environment II Lab_MI10448MI__________.pptx
Mine Environment II Lab_MI10448MI__________.pptxRomil Mishra
 
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTIONTHE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTIONjhunlian
 
『澳洲文凭』买麦考瑞大学毕业证书成绩单办理澳洲Macquarie文凭学位证书
『澳洲文凭』买麦考瑞大学毕业证书成绩单办理澳洲Macquarie文凭学位证书『澳洲文凭』买麦考瑞大学毕业证书成绩单办理澳洲Macquarie文凭学位证书
『澳洲文凭』买麦考瑞大学毕业证书成绩单办理澳洲Macquarie文凭学位证书rnrncn29
 
11. Properties of Liquid Fuels in Energy Engineering.pdf
11. Properties of Liquid Fuels in Energy Engineering.pdf11. Properties of Liquid Fuels in Energy Engineering.pdf
11. Properties of Liquid Fuels in Energy Engineering.pdfHafizMudaserAhmad
 
Novel 3D-Printed Soft Linear and Bending Actuators
Novel 3D-Printed Soft Linear and Bending ActuatorsNovel 3D-Printed Soft Linear and Bending Actuators
Novel 3D-Printed Soft Linear and Bending ActuatorsResearcher Researcher
 
US Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of ActionUS Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of ActionMebane Rash
 
Engineering Drawing section of solid
Engineering Drawing     section of solidEngineering Drawing     section of solid
Engineering Drawing section of solidnamansinghjarodiya
 
signals in triangulation .. ...Surveying
signals in triangulation .. ...Surveyingsignals in triangulation .. ...Surveying
signals in triangulation .. ...Surveyingsapna80328
 
TEST CASE GENERATION GENERATION BLOCK BOX APPROACH
TEST CASE GENERATION GENERATION BLOCK BOX APPROACHTEST CASE GENERATION GENERATION BLOCK BOX APPROACH
TEST CASE GENERATION GENERATION BLOCK BOX APPROACHSneha Padhiar
 
Cost estimation approach: FP to COCOMO scenario based question
Cost estimation approach: FP to COCOMO scenario based questionCost estimation approach: FP to COCOMO scenario based question
Cost estimation approach: FP to COCOMO scenario based questionSneha Padhiar
 
multiple access in wireless communication
multiple access in wireless communicationmultiple access in wireless communication
multiple access in wireless communicationpanditadesh123
 
Energy Awareness training ppt for manufacturing process.pptx
Energy Awareness training ppt for manufacturing process.pptxEnergy Awareness training ppt for manufacturing process.pptx
Energy Awareness training ppt for manufacturing process.pptxsiddharthjain2303
 
CME 397 - SURFACE ENGINEERING - UNIT 1 FULL NOTES
CME 397 - SURFACE ENGINEERING - UNIT 1 FULL NOTESCME 397 - SURFACE ENGINEERING - UNIT 1 FULL NOTES
CME 397 - SURFACE ENGINEERING - UNIT 1 FULL NOTESkarthi keyan
 
Turn leadership mistakes into a better future.pptx
Turn leadership mistakes into a better future.pptxTurn leadership mistakes into a better future.pptx
Turn leadership mistakes into a better future.pptxStephen Sitton
 

Recently uploaded (20)

KCD Costa Rica 2024 - Nephio para parvulitos
KCD Costa Rica 2024 - Nephio para parvulitosKCD Costa Rica 2024 - Nephio para parvulitos
KCD Costa Rica 2024 - Nephio para parvulitos
 
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor CatchersTechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
 
Research Methodology for Engineering pdf
Research Methodology for Engineering pdfResearch Methodology for Engineering pdf
Research Methodology for Engineering pdf
 
Immutable Image-Based Operating Systems - EW2024.pdf
Immutable Image-Based Operating Systems - EW2024.pdfImmutable Image-Based Operating Systems - EW2024.pdf
Immutable Image-Based Operating Systems - EW2024.pdf
 
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENT
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENTFUNCTIONAL AND NON FUNCTIONAL REQUIREMENT
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENT
 
Robotics Group 10 (Control Schemes) cse.pdf
Robotics Group 10  (Control Schemes) cse.pdfRobotics Group 10  (Control Schemes) cse.pdf
Robotics Group 10 (Control Schemes) cse.pdf
 
Mine Environment II Lab_MI10448MI__________.pptx
Mine Environment II Lab_MI10448MI__________.pptxMine Environment II Lab_MI10448MI__________.pptx
Mine Environment II Lab_MI10448MI__________.pptx
 
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTIONTHE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
 
『澳洲文凭』买麦考瑞大学毕业证书成绩单办理澳洲Macquarie文凭学位证书
『澳洲文凭』买麦考瑞大学毕业证书成绩单办理澳洲Macquarie文凭学位证书『澳洲文凭』买麦考瑞大学毕业证书成绩单办理澳洲Macquarie文凭学位证书
『澳洲文凭』买麦考瑞大学毕业证书成绩单办理澳洲Macquarie文凭学位证书
 
11. Properties of Liquid Fuels in Energy Engineering.pdf
11. Properties of Liquid Fuels in Energy Engineering.pdf11. Properties of Liquid Fuels in Energy Engineering.pdf
11. Properties of Liquid Fuels in Energy Engineering.pdf
 
Novel 3D-Printed Soft Linear and Bending Actuators
Novel 3D-Printed Soft Linear and Bending ActuatorsNovel 3D-Printed Soft Linear and Bending Actuators
Novel 3D-Printed Soft Linear and Bending Actuators
 
US Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of ActionUS Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of Action
 
Engineering Drawing section of solid
Engineering Drawing     section of solidEngineering Drawing     section of solid
Engineering Drawing section of solid
 
signals in triangulation .. ...Surveying
signals in triangulation .. ...Surveyingsignals in triangulation .. ...Surveying
signals in triangulation .. ...Surveying
 
TEST CASE GENERATION GENERATION BLOCK BOX APPROACH
TEST CASE GENERATION GENERATION BLOCK BOX APPROACHTEST CASE GENERATION GENERATION BLOCK BOX APPROACH
TEST CASE GENERATION GENERATION BLOCK BOX APPROACH
 
Cost estimation approach: FP to COCOMO scenario based question
Cost estimation approach: FP to COCOMO scenario based questionCost estimation approach: FP to COCOMO scenario based question
Cost estimation approach: FP to COCOMO scenario based question
 
multiple access in wireless communication
multiple access in wireless communicationmultiple access in wireless communication
multiple access in wireless communication
 
Energy Awareness training ppt for manufacturing process.pptx
Energy Awareness training ppt for manufacturing process.pptxEnergy Awareness training ppt for manufacturing process.pptx
Energy Awareness training ppt for manufacturing process.pptx
 
CME 397 - SURFACE ENGINEERING - UNIT 1 FULL NOTES
CME 397 - SURFACE ENGINEERING - UNIT 1 FULL NOTESCME 397 - SURFACE ENGINEERING - UNIT 1 FULL NOTES
CME 397 - SURFACE ENGINEERING - UNIT 1 FULL NOTES
 
Turn leadership mistakes into a better future.pptx
Turn leadership mistakes into a better future.pptxTurn leadership mistakes into a better future.pptx
Turn leadership mistakes into a better future.pptx
 

Java Interview.pdf

  • 2. Hi Priya! I am Ashay. I am going to take your technical round. Hey Ashay! Thanks for giving me this oppportunity. By Ashay Nayak
  • 3. I am going to ask few Java Questions. okay. By Ashay Nayak
  • 4. What is garbage collection in Java? If any object is no longer in use then we should remove that object from heap memory. The process of removing unused objects from heap memory is known as Garbage collection. By Ashay Nayak
  • 5. hmm... Why do we use finalize () method in Java? Sometimes object contains non- java resources like connection details and we want that object to release those resources before getting deleted. Thus, garbage collector calls finalize() method just before deleting the object where all resources get released. By Ashay Nayak
  • 6. By Ashay Nayak finalize() method present in Object class doesn’t contain any implementation. So there is a need to override the finalize() method to define the actions which we want to do before object deletion. Let’s say we have created a Test class. We will override finalize() method inside it. Now when any object of the Test class becomes eligible for garbage collection, this override method will be called. If you don’t override then the default implementation of finalize() method present in the Object class will be called and nothing will happen as it doesn’t contain any implementation. Knowledge for You
  • 7. To Be Continued... By Ashay Nayak