• Tutorials
  • Courses
Switch to Dark Mode

Which statement about final, finally, and finalize is correct?

Last Updated : Apr 3, 2025
Discuss
Comments

Which statement about final, finally, and finalize is correct?

A

final is used to handle exceptions, finally is used for garbage collection, and finalize prevents modification.

B

final makes a variable constant, finally ensures execution of cleanup code, and finalize is called before garbage collection.

C

final is a method, finally is a keyword, and finalize is a block inside try-catch.


D

final, finally, and finalize all serve the same purpose.

Share your thoughts in the comments