Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 751393e

Browse files
author
Ram swaroop
committed
simple gc example
1 parent c40271e commit 751393e

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package me.ramswaroop.misc;
2+
3+
/**
4+
* Created by IntelliJ IDEA.
5+
*
6+
* @author: ramswaroop
7+
* @date: 10/2/15
8+
* @time: 12:44 AM
9+
*/
10+
public class GarbageCollection {
11+
public void finalize() {
12+
System.out.println("object is garbage collected");
13+
}
14+
15+
public static void main(String args[]) {
16+
GarbageCollection s1 = new GarbageCollection();
17+
GarbageCollection s2 = new GarbageCollection();
18+
s1 = null;
19+
s2 = null;
20+
System.gc();
21+
}
22+
}

0 commit comments

Comments
 (0)