A question about GC

Posted by chun on Stack Overflow See other posts from Stack Overflow or by chun
Published on 2010-04-26T14:05:08Z Indexed on 2010/04/26 14:13 UTC
Read the original article Hit count: 251

Filed under:

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?

© Stack Overflow or respective owner

Related posts about java