Java System runFinalization()方法

java.lang.System.runFinalization() 方法运行最后审定的任何对象最后确定方法。

1 语法

public static void runFinalization()

2 参数

3 返回值

此方法不返回任何值。

4 示例 

package com.yiidian;

/**
 * 一点教程网: http://www.yiidian.com
 */
/**
 * Java System runFinalization()方法
 */
import java.lang.*;

public class SystemDemo {

   public static void main(String[] args) throws Exception {

     File file1 = new File("abcd");
   
     // returns the HashCode
     int ret = System.identityHashCode(file1);
     System.out.println(ret);
   
     // returns the current value of the system timer, in milliseconds
     System.out.print("time in milliseconds = ");
     System.out.println(System.currentTimeMillis());
    
     System.out.println("finalization of any objects pending finalization!");
     System.runFinalization();
     System.out.println("Done!!!");    
   }
} 

输出结果为:

355165777
time in milliseconds = 1350971291853
finalization of any objects pending finalization!
Done!!!

 

热门文章

优秀文章