class Robot
{
long memory[] = new long[9923372];
private String name;
Robot(String nm) throws Exception
{
name = nm;
System.out.println("name = " + name);
}
protected void finalize()
{
System.out.println("\nBye - Bye ---eeeee " + name+"\n");
}
}
class Test
{
public static void main(String sdf[]) throws Exception
{
int i=1;
Robot robot1;
while(true)
{
//finalizer runs before the dereference of rajni - 1
robot1= new Robot("Rajni - "+i++);
Thread.sleep(1000);
}
}
}
how can finalizer run before derefernce of robot1 from rajni1 first object ... the loop runs in the infinite loop...
i know that garbage collector runs whenever heap space is low and more memory is required for the object allocation...but the condition is that there must be some dereferenced object residing in memory .....
--->run in jre 32 bit to get the given output ... you better know why??