Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class FinalizerTest {
- private static volatile FinalizerTest sharedInstance;
- @Override
- protected void finalize() throws Throwable {
- sharedInstance = this;
- }
- public static void main(final String args[]) {
- int value = 0;
- for (int i = 0; i < 1; i++) {
- final FinalizerTest instance = new FinalizerTest();
- value ^= instance.hashCode();
- }
- for (int i = 0; i < 20; i++) {
- System.gc();
- }
- System.out.println(sharedInstance);
- System.exit(value);
- }
- }
Add Comment
Please, Sign In to add comment