How does Garbage Collector works for Primitive Data type in Java?
garbage-collection, java
Solution
Primitive data types are either fields in objects or used in arrays which themselves are objects. For the garbage collector these fields are not relevant, because they do not contain pointers. They can be perfectly ignored and will be freed together with the object/array once it gets garbage collected.
Problem
As we know for Object its works through Reference counting and other such Algorithm. But for Primitive Data types, we can't make it `NULL` like: ``` int a = NULL; ``` How does Garbage Collector work for Primitive datatypes in Java?