Garbage collection

class Test
{
Test()
{
double a1[]=new double[1000000];
double a2[]=new double[1000000];
double a3[]=new double[1000000];
double a4[]=new double[1000000];
}
protected void finalize() throws Throwable
{
System.out.println("Finalize called");
}
public static void main(String[] args) throws Throwable
{
Test ob=new Test();
ob.finalize();//explicitly calling the finalize method
System.out.println("Hello World!"+ob);
ob=null;//Garbage collection may /May not be called if there are unused objects
System.out.println("Hell");
System.gc();//Garbage collection will be called if there are unused objects
Runtime.getRuntime().gc();//Garbage collection will be called if there are unused objects
System.out.println("The total free memory available is\t"+Runtime.getRuntime().freeMemory());
System.out.println("The total memory available is\t"+Runtime.getRuntime().totalMemory());
System.out.println("The total free memory available is\t"+(Runtime.getRuntime().freeMemory())/(1024*1024) +"MB");
System.out.println("The total memory available is\t"+(Runtime.getRuntime().totalMemory())/(1024*1024) +"MB");
}
}