References in JAVA

There are 4 types of references in JAVA: strong references, soft references, weak references, phantom references.
Those references differ only by the way the garbage collector manages them. If you have never heard of them, it means that you were only using the strong ones. Knowing the difference can help you, especially if you need to store temporary objects and can’t use a real caching library like eHcache or Guava.
Since those types are stongly related to the JVM garbage collector, I’ll briefly recall some information about garbage collection in JAVA and then I’ll present the differents types.

Proudly powered by WordPress   Premium Style Theme by www.gopiplus.com