Question: How do you force an object to be garbage collected?
- Set object to null and call Runtime.gc()
- Set object to null and call System.gc()
- Set object to null and call Runtime.getRuntime().runFinalization()
- There is no way to force an object to be garbage collected
Answer: The correct answer of the above question is Option B:Set object to null and call System.gc()