Finalize Method Program

Write a program in java to demonstrate the Finalize Method

 
public class FinalizeMethod 
{ 
 int a[];
 FinalizeMethod()
 {
  a = new int[1000];
  System.out.println("Constructor");
 }
 public static void main(String[] args) 
 {
  for(int i=0;i<30;i++)
   new FinalizeMethod();
 }
 protected void finalize()
 {
  System.out.println("Finalize Method");
 }
}

0 comments:

Post a Comment