I share my learnings here. Thanks for reading.
Nothing here yet.
Yes, that's right. I showed both types of initialization one after the other to highlight the difference. If we don't pass any arguments, it will by default take the type Object. In the raw type, we don't pass any arguments during initialization. Print rawTypePrintObject = new Print();
Now I understand your point Shubham Kesri Please let me know if there are any additional changes required in the updated version. The corrected (updated) Mark and Sweep algorithm is as follows: First, we delete unreferenced objects that are no longer in use. Mark the surviving referenced objects. Sweep the marked objects to the next survivor level. I will update the main article shortly. Thank you for taking the time to help me correct the logic!
Shubham Kesri "Objects o2 and o5 do not have any references. So mark these two." this is correct one At a given timestamp, the created objects o2 and o5 are present, but no variable is pointing to these objects. Hence, the garbage collector marks these two objects and sweeps them away.
Can you please provide more details or quote the exact places where the referenced objects are marked and swept? (Working of Garbage Collector) The garbage collector's operation correctly uses the mark and sweep algorithm. That's the right one.