You have implemented finalize in your Test class. You do not create an instance of your Test class. So no instance of the Test class needs to be garbage collected (or rather, is eligible for garbage collection)
Hello, Finalize method is called when object of a class is created and completes its work, but remember finalize method should in the class whose garbage it has to be collect. In your code you implemented in the test class, but no where object of Test class is created so this finalize method will not called by gc. new Interger is calling finalize method of Integer class not Test class. Try the code below hope it will clear you.