A finalizer is a special method in an object-oriented language that is executed when an object is garbage collected.