Skip to content

Instantly share code, notes, and snippets.

@orionll
Created November 11, 2018 04:19
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 orionll/0e41ca0c68438ad744ab67d9f32034c3 to your computer and use it in GitHub Desktop.
Save orionll/0e41ca0c68438ad744ab67d9f32034c3 to your computer and use it in GitHub Desktop.
import java.lang.ref.WeakReference;
public final class Main {
public static void main(String... args) throws Throwable {
Integer i = new Integer(1);
WeakReference<Integer> ref = new WeakReference<>(i);
System.gc();
System.out.println(ref.get());
i.signum(0);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment