Object.finalize() has the following syntax.
protected void finalize() throws Throwable
In the following code shows how to use Object.finalize() method.
public class Main { public static void main(String[] args) throws Throwable { Main cal = new Main(); cal.finalize(); } }