Skip to content

Instantly share code, notes, and snippets.

@simlegate
Created October 20, 2014 08:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simlegate/5b72524616ec2db261aa to your computer and use it in GitHub Desktop.
Save simlegate/5b72524616ec2db261aa to your computer and use it in GitHub Desktop.
Java垃圾回收机制循环引用问题
class A{
public B b;
}
class B{
public A a;
}
public class Main{
public static void main(String[] args){
A a = new A();
B b = new B();
a.b=b;
b.a=a;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment