package com.java.gc;
public class FinalizeDemo { static FinalizeDemo s;
public static void main(String[] args) throws InterruptedException
{
    FinalizeDemo f = new FinalizeDemo();
    System.out.println("f hashcode:" +f.hashCode());
    f=null;
    System.gc();
    Thread.sleep(5000);
    System.out.println("s hashcode:"+s.hashCode());
    s=null;
    Thread.sleep(10000);
    System.out.println("ENd of main");
}
public void finlaize()
{
    System.out.println("Finlaize method called");
    s=this;
}
}
Getting NPE while runnig this code , can anyone please help me?
 
    