source code call garbage collection use some methods
package funds;
class Sam
{
int i=10;
String n="java";
}
public class GCRun {
public static void main(String arg[])
{
Sam s=new Sam();
s=null;
System.gc();
Sam s2=new Sam();
s2=null;
Runtime r=Runtime.getRuntime();
r.gc();
}
}
0 comments:
Post a Comment