How does the Java Garbage Collector work, and what are some common strategies to prevent memory leaks?