Question: What is the difference between finally and finalize blocks?

  1. The finally block is called during the execution of a try and catch block, while the finalize method is called after garbage collection.
  2. The finally block is called after the execution of a try and catch block, while the finalize method is called just before garbage collection.
  3. The finalize block is called before the execution of a try and catch block, while the finally method is called just before garbage collection.
  4. The finalize block is called during the execution of a try and catch block, while the finally method is called after garbage collection.

Answer: The correct answer of the above question is Option B:The finally block is called after the execution of a try and catch block, while the finalize method is called just before garbage collection.