In this example we will show the method to finalize object in Java.
Source Code
package com.beginner.examples;
public class RunFinalization {
public static void main(String[] args){
Runtime run = Runtime.getRuntime();
run.runFinalization(); // finalize object
System.out.println("OK!");
}
}
Output:
OK!