Understanding various available reference objects in Java is quite important to develop memory sensitive applications, and for memory optimization. Java has four type of memory references which are
Strong Reference: The objects in memory which are referenced from memory stack (without a reference through any other kind of reference) are called strongly referenced. These objects are strongly held by program i.e. in use and hence can not be claimed by GC (Garbage Collector) for memory requirement.
- Strong References,
- Soft References,
- Weak References and
- Phantom References
Strong Reference: The objects in memory which are referenced from memory stack (without a reference through any other kind of reference) are called strongly referenced. These objects are strongly held by program i.e. in use and hence can not be claimed by GC (Garbage Collector) for memory requirement.