How can memory leaks be detected in Java applications?
Memory leaks can be detected by manually monitoring object references and ensuring that they are nullified when no longer needed.
Thatâ€™s partially correct. While manually monitoring references is helpful, profiling tools like JVisualVM are more effective at automatically detecting memory leaks.
Can you explain how the `ReferenceQueue` works in Java to help detect unreachable objects and memory leaks?