This is the piece of code. The finalize() method should invoke after the System.gc() command but its not. Any suggestions?
class test123{
test123(){
System.out.println("Inside the constructor");
}
}
public class finalizemerthd {
public static void main(String args[]) {
test123 obj1 = new test123();
obj1 = null;
System.gc();
}
protected void finalize() throws Throwable
{
System.out.println("Garbage collector called");
System.out.println("Object garbage collected : " + this);
}
}