What is the difference between final, finally and finalize in Java?
They sound alike and have nothing to do with each other. final is a keyword that makes a class, method or variable unchangeable. finally is a block that runs after a try statement no matter how it exits. finalize() was a method on Object that the garbage collector used to call before reclaiming an object.
The detail worth knowing is that finalize() has been deprecated for removal and was scheduled for deletion. It was never reliable: the collector may or may not run it, it may run it long after the object became unreachable, and it runs on the finalizer thread rather than your own thread, so any code inside it has to be thread-safe. Two objects with finalizers also promote each other into a special queue, which costs memory and delays collection. In effect it was an attempt to give Java deterministic cleanup that never worked, and the language replaced it with better tools.
What replaced it depends on what you were trying to do. For a resource that holds an operating system handle, use try-with-resources and do not rely on finalization at all. For a cleanup that must happen regardless of how the object was discarded, implement java.lang.AutoCloseable and close it explicitly. And when you genuinely need a hook that runs when the object becomes unreachable, java.lang.ref.Cleaner gives you an explicit registration mechanism without the finalization queue.
The interview summary is short: final is about immutability, finally is about cleanup on every path, and finalize was a broken idea that has been retired.