A question about GC
java
Solution
Yes, it does collect Main object. Since integer is neither a separate object by itself (it's a member of Main) not a pointer it won't be collected separately but only as a part of Main.
Problem
This is a quesiton taken from a java exam, How many objects are eligible for gabage collection at #1 ? ``` public class Main { Integer x = 32768; public static void main(String[] args) { Main m = new Main(); m = null; // #1 } } ``` I thought it just collect Integer x, does GC even collect the Main object m?