Does variable = null set it for garbage collection

That’s old performance lore. It was true back in 1.0 days, but the compiler and the JVM have been improved to eliminate the need (if ever there was one). This excellent IBM article gets into the details if you’re interested: Java theory and practice: Garbage collection and performance

Leave a Comment