What is a memory leak in Java?
A memory leak in Java happens when you explicitly tell the JVM not to remove certain objects from memory, causing them to stay in memory indefinitely.
Thatâ€™s incorrect. Memory leaks in Java typically occur due to lingering references, not because of explicit instructions to prevent removal.
Can you explain the role of references like `SoftReference` and `WeakReference` in managing memory effectively?