1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
/* Run object finalization using System class This example shows how to run the object finalization by using runFinalization method of Java System class. */ public class RunFinalizationOfObjects { public static void main(String[] args) { /* * To run finalization method of discarded objects use, * public static void runFinalization() method of * System class. * * Please note that calling this method only SUGGESTS the JVM * to run finalize method of discarded objects */ System.out.println("Suggesting JVM to run finalize method"); System.runFinalization(); System.out.println("Suggested JVM to run finalize method"); } } |
Add Comment