What is garbage collection in Java, and how can it be used ?

Answer Posted / rintu kumar kanp

Finding garbage and reclaiming memory allocated to it.
Garbage holds unreferenced objects
ex:-
Student ali= new Student();
Student khalid= new Student();
ali=khalid;
Now ali Object becomes a garbage,
It is unreferenced Object


it be used When the total memory allocated to a Java
program exceeds some threshold.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why object class is super class for every class in java?

578


How does singleton class work?

529


Is arraylist an object in java?

602


What is regex used for?

546


What are runtime exceptions?

617






How does multithreading take place on a computer with a single cpu?

545


How does arraylist size increase in java?

531


How do you use wildcards?

536


Why hashset is used in java?

538


What are static variables and functions?

628


Can we define private and protected modifiers for variables in interfaces?

583


What is method in research paper?

575


how would you implement a thread pool? : Java thread

510


How do you check if a string is lexicographically in java?

503


What happens if we override private method?

525