How is Garbage collection done in Java?
Answer Posted / harish
Garbage Collection is carried out based on the reference
type an object is currently in.
There are 4 types of references in java
1)strong reference
2)soft reference
3)weak reference
4)phantom reference
the last one is the weakest of the weak.
JVM will try get all those of object that are fell in this
category and try to collect it.
But it is not neccessary the object in phantom reference
phase will always be garbage collected.
Is This Answer Correct ? | 4 Yes | 3 No |
Post New Answer View All Answers
What is an infinite loop?
Does java isempty check for null?
Explain the importance of thread scheduler in java?
What is starvation?
What is a data structure java?
Why is singleton instance static?
What is the size of int in 64-bit jvm?
What is the diffrence between inner class and nested class?
Draw a UML class diagram for the code fragment given below: public class StringApplet extends Applet { private Label sampleString; private Button showTheString; private ButtonHandler bHandler; private FlowLayout layout; public StringApplet() { sampleString = new Label(" "); showTheString = new Button (" Show the String"); bHandler = new ButtonHandler(); layout = new FlowLayout(); showTheString.addActionListener(bHandler); setLayout(layout); add(sampleString); add(showTheString); } class ButtonHandler implements ActionListener { public void actionPerformed(ActionEvent e) { samplestring.setText("Good Morning"); } } } Note: The methods need not be indicated on the diagram.
Is it safe to install java on my computer?
What is comparable and comparator interface? List their differences
What is object in java?
How will you load a specific locale?
What is the meaning of immutable regarding string?
What is sorting in java?